testmain.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #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>
  10. using namespace std;
  11. #ifdef BENCHMARK
  12. #define MEMSIZE 300000
  13. #else
  14. #define MEMSIZE 230000
  15. #endif
  16. // Dummy (will be generated by python scripts)
  17. // char* array describing the tests and the input patterns.
  18. // Reference patterns are ignored in this case.
  19. #include "TestDrive.h"
  20. #include "Patterns.h"
  21. int testmain()
  22. {
  23. char *memoryBuf=NULL;
  24. memoryBuf = (char*)malloc(MEMSIZE);
  25. if (memoryBuf !=NULL)
  26. {
  27. try
  28. {
  29. // Choice of a memory manager.
  30. // Here we choose the Array one (only implemented one)
  31. Client::ArrayMemory memory(memoryBuf,MEMSIZE);
  32. // There is also possibility of using "FPGA" io
  33. //Client::Semihosting io("../TestDesc.txt","../Patterns","../Output","../Parameters");
  34. Client::FPGA io(testDesc,patterns);
  35. // Pattern Manager making the link between IO and Memory
  36. Client::PatternMgr mgr(&io,&memory);
  37. // A Runner to run the test.
  38. // An IO runner is driven by some IO
  39. // In future one may have a client/server runner driven
  40. // by a server running on a host.
  41. Client::IORunner runner(&io,&mgr,Testing::kTestAndDump);
  42. // Root object containing all the tests
  43. Root d(1);
  44. // Runner applied to the tree of tests
  45. d.accept(&runner);
  46. }
  47. catch(...)
  48. {
  49. printf("Exception\n");
  50. }
  51. free(memoryBuf);
  52. }
  53. else
  54. {
  55. printf("NOT ENOUGH MEMORY\n");
  56. }
  57. /* code */
  58. return 0;
  59. }