PageRenderTime 40ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/WabbitStudio/Tests/SPASMTests/AssembleTests.cpp

#
C++ | 58 lines | 50 code | 8 blank | 0 comment | 2 complexity | 46220fef0657ac7bacbe55f804917052 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. #include "stdafx.h"
  2. #pragma comment(lib, "spasm.lib")
  3. #include "..\SPASM\pass_one.h"
  4. #include "..\SPASM\pass_two.h"
  5. #include "..\SPASM\parser.h"
  6. #include "..\SPASM\spasm.h"
  7. #include "..\SPASM\errors.h"
  8. #include "..\SPASM\storage.h"
  9. using namespace System;
  10. using namespace System::Text;
  11. using namespace System::Collections::Generic;
  12. using namespace Microsoft::VisualStudio::TestTools::UnitTesting;
  13. namespace SPASMTestsVS2008
  14. {
  15. [TestClass]
  16. public ref class AssembleTests
  17. {
  18. public:
  19. [TestMethod]
  20. void directivemacro()
  21. {
  22. BYTE Results[] = {'h', 'e', 'l', 'l', 'o', 0x00};
  23. output_filename = strdup("test.bin");
  24. mode = MODE_NORMAL;
  25. init_storage();
  26. output_contents = (unsigned char *) malloc(1000);
  27. curr_input_file = strdup("..\\..\\..\\..\\..\\Tests\\SPASMTests\\directivemacro.z80");
  28. int result = run_assembly();
  29. for (int i = 0; i < sizeof(Results); i++)
  30. {
  31. Assert::AreEqual(Results[i], output_contents[i], gcnew String("Unequal at index: ") + i);
  32. }
  33. }
  34. [TestMethod]
  35. void echofill()
  36. {
  37. BYTE Results[] = {'A', 'Z', 'Z', 'Z', 'Z'};
  38. output_filename = strdup("test.bin");
  39. mode = MODE_NORMAL;
  40. init_storage();
  41. output_contents = (unsigned char *) malloc(1000);
  42. curr_input_file = strdup("..\\..\\..\\..\\..\\Tests\\SPASMTests\\echofill.z80");
  43. int result = run_assembly();
  44. for (int i = 0; i < sizeof(Results); i++)
  45. {
  46. Assert::AreEqual(Results[i], output_contents[i], gcnew String("Unequal at index: ") + i);
  47. }
  48. }
  49. };
  50. }