blob: eb5014a7e2b933c5e9c906f7c02e694cb3da889c [file] [log] [blame]
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +02001#include <cstdlib>
2#include <cstdio>
3#include <iostream>
4#include "TestDesc.h"
5#include "Semihosting.h"
6#include "FPGA.h"
7#include "IORunner.h"
8#include "ArrayMemory.h"
9#include <stdlib.h>
10using namespace std;
11
12#define MEMSIZE 64000
13
14// Dummy (will be generated by python scripts)
15// char* array describing the tests and the input patterns.
16// Reference patterns are ignored in this case.
17#include "TestDrive.h"
18#include "Patterns.h"
19
20
21int testmain()
22{
23 char *memoryBuf=NULL;
24
25 memoryBuf = (char*)malloc(MEMSIZE);
26 if (memoryBuf !=NULL)
27 {
28 try
29 {
30 // Choice of a memory manager.
31 // Here we choose the Array one (only implemented one)
32 Client::ArrayMemory memory(memoryBuf,MEMSIZE);
33
34 // There is also possibility of using "FPGA" io
35 //Client::Semihosting io("../TestDesc.txt","../Patterns","../Output","../Parameters");
36 Client::FPGA io(testDesc,patterns);
37
38
39 // Pattern Manager making the link between IO and Memory
40 Client::PatternMgr mgr(&io,&memory);
41
42
43 // A Runner to run the test.
44 // An IO runner is driven by some IO
45 // In future one may have a client/server runner driven
46 // by a server running on a host.
47 Client::IORunner runner(&io,&mgr,Testing::kTestAndDump);
48
49
50 // Root object containing all the tests
51 Root d(1);
52
53 // Runner applied to the tree of tests
54 d.accept(&runner);
55
56 }
57 catch(...)
58 {
59 printf("Exception\n");
60 }
61
62
63 free(memoryBuf);
64 }
65 else
66 {
67 printf("NOT ENOUGH MEMORY\n");
68 }
69
70 /* code */
71 return 0;
72}