PageRenderTime 21ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/WabbitStudio/Tests/SPASMTests/AssembleTests.cpp

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