testmain.cpp 1.7 KB

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