MCPcopy Create free account
hub / github.com/WheretIB/nullc / RunInterfaceTests

Function RunInterfaceTests

tests/TestInterface.cpp:26–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24 }
25
26void RunInterfaceTests()
27{
28 unsigned int testTarget[] = { NULLC_VM, NULLC_X86, NULLC_LLVM };
29
30 if(Tests::messageVerbose)
31 printf("Two bytecode merge test 1\r\n");
32
33 const char *partA1 = "int a = 5;\r\nint c = 8;\r\nint test(int ref a, int b)\r\n{\r\n\treturn *a += b;\r\n}\r\ntest(&a, 4);\r\nint run(){ test(&a, 4); return c; }\r\n";
34 const char *partB1 = "int aa = 15;\r\nint testA(int ref a, int b)\r\n{\r\n\treturn *a += b + 1;\r\n}\r\ntestA(&aa, 5);\r\nvoid runA(){ testA(&aa, 5); }\r\nreturn aa;\r\n";
35
36 char *bytecodeA, *bytecodeB;
37 bytecodeA = NULL;
38 bytecodeB = NULL;
39
40 for(int t = 0; t < TEST_COUNT; t++)
41 {
42 if(!Tests::testExecutor[t])
43 continue;
44 testsCount[t]++;
45 nullcSetExecutor(testTarget[t]);
46
47 nullres good = nullcCompile(partA1);
48 nullcSaveListing("asm.txt");
49 if(!good)
50 {
51 if(!Tests::messageVerbose)
52 printf("Two bytecode merge test 1\r\n");
53 printf("Compilation failed: %s\r\n", nullcGetLastError());
54 continue;
55 }else{
56 nullcGetBytecode(&bytecodeA);
57 }
58
59 good = nullcCompile(partB1);
60 nullcSaveListing("asm.txt");
61 if(!good)
62 {
63 if(!Tests::messageVerbose)
64 printf("Two bytecode merge test 1\r\n");
65 printf("Compilation failed: %s\r\n", nullcGetLastError());
66 continue;
67 }else{
68 nullcGetBytecode(&bytecodeB);
69 }
70
71 nullcClean();
72 if(!nullcLinkCode(bytecodeA))
73 {
74 if(!Tests::messageVerbose)
75 printf("Two bytecode merge test 1\r\n");
76 printf("Compilation failed: %s\r\n", nullcGetLastError());
77 continue;
78 }
79 if(!nullcLinkCode(bytecodeB))
80 {
81 if(!Tests::messageVerbose)
82 printf("Two bytecode merge test 1\r\n");
83 printf("Compilation failed: %s\r\n", nullcGetLastError());

Callers 1

RunTestsFunction · 0.85

Calls 15

nullcSetExecutorFunction · 0.85
nullcCompileFunction · 0.85
nullcSaveListingFunction · 0.85
nullcGetLastErrorFunction · 0.85
nullcGetBytecodeFunction · 0.85
nullcCleanFunction · 0.85
nullcLinkCodeFunction · 0.85
nullcRunFunctionFunction · 0.85
nullcGetGlobalFunction · 0.85
nullcSetGlobalFunction · 0.85
nullcGetResultIntFunction · 0.85
nullcGetVariableDataFunction · 0.85

Tested by

no test coverage detected