Web assembly #6
2 changed files with 6 additions and 108 deletions
|
|
@ -42,11 +42,6 @@ struct Entity
|
||||||
uint ind = cast(uint)((cast(void*)&this - block.dataBegin()) / EntityID.sizeof());
|
uint ind = cast(uint)((cast(void*)&this - block.dataBegin()) / EntityID.sizeof());
|
||||||
return cast(T*)(cast(void*)block + info.deltas[T.component_id] + ind * T.sizeof);
|
return cast(T*)(cast(void*)block + info.deltas[T.component_id] + ind * T.sizeof);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*package void updateID() nothrow @nogc
|
|
||||||
{
|
|
||||||
EntityManager.instance.id_manager.update(this);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************************************************
|
/************************************************************************************************************************
|
||||||
|
|
|
||||||
109
tests/runner.d
109
tests/runner.d
|
|
@ -9,11 +9,6 @@ import ecs.vector;
|
||||||
import ecs.simple_vector;
|
import ecs.simple_vector;
|
||||||
import ecs.std;
|
import ecs.std;
|
||||||
|
|
||||||
unittest
|
|
||||||
{
|
|
||||||
assert(0,"This will fail!");
|
|
||||||
}
|
|
||||||
|
|
||||||
enum int ASSERTED = 123;
|
enum int ASSERTED = 123;
|
||||||
enum string OUT_FILE = "test_report.xml";
|
enum string OUT_FILE = "test_report.xml";
|
||||||
|
|
||||||
|
|
@ -37,12 +32,11 @@ struct Test
|
||||||
{
|
{
|
||||||
string file;
|
string file;
|
||||||
string msg;
|
string msg;
|
||||||
int fileLine;
|
int file_line;
|
||||||
string name;
|
string name;
|
||||||
//string classname;
|
//string classname;
|
||||||
int time;
|
int time;
|
||||||
bool passed;
|
bool passed;
|
||||||
//bool executed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TestSuite
|
struct TestSuite
|
||||||
|
|
@ -53,94 +47,6 @@ struct TestSuite
|
||||||
Vector!Test tests;
|
Vector!Test tests;
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeToFile(string data)
|
|
||||||
{
|
|
||||||
auto file = fopen(OUT_FILE, "a");
|
|
||||||
fwrite(data.ptr, 1, data.length, file);
|
|
||||||
fclose(file);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeToFile(int num)
|
|
||||||
{
|
|
||||||
auto file = fopen(OUT_FILE, "a");
|
|
||||||
fprintf(file, "%d", num);
|
|
||||||
fclose(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeResulStart(int num)
|
|
||||||
{
|
|
||||||
// Clear file
|
|
||||||
auto file = fopen(OUT_FILE, "w");
|
|
||||||
fclose(file);
|
|
||||||
|
|
||||||
writeToFile("<testsuite tests=\"");
|
|
||||||
writeToFile(num);
|
|
||||||
writeToFile("\">\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeResulEnd()
|
|
||||||
{
|
|
||||||
writeToFile("</testsuite>\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeResult(ref TestSuite suite, ref Test result)
|
|
||||||
{
|
|
||||||
writeToFile(" <testcase classname=\"");
|
|
||||||
writeToFile(suite.name);
|
|
||||||
writeToFile("\" name=\"");
|
|
||||||
writeToFile(result.name);
|
|
||||||
writeToFile("\" time=\"");
|
|
||||||
writeToFile(result.time);
|
|
||||||
writeToFile("\" ");
|
|
||||||
//writeToFile(" executed=\"");
|
|
||||||
//writeToFile(cast(int) result.executed);
|
|
||||||
writeToFile("\" ");
|
|
||||||
|
|
||||||
if (result.passed)
|
|
||||||
{
|
|
||||||
writeToFile("/>\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
writeToFile(">\n");
|
|
||||||
writeToFile(" <failure type=\"Fail\">");
|
|
||||||
|
|
||||||
if (result.file.length != 0)
|
|
||||||
{
|
|
||||||
writeToFile("Assert! File: ");
|
|
||||||
writeToFile(result.file[0 .. $ - 1]);
|
|
||||||
writeToFile(":");
|
|
||||||
writeToFile(result.fileLine);
|
|
||||||
writeToFile(" Message: ");
|
|
||||||
writeToFile(result.msg[0 .. $ - 1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
writeToFile("No Message");
|
|
||||||
}
|
|
||||||
|
|
||||||
writeToFile("</failure>\n");
|
|
||||||
writeToFile(" </testcase>\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeTests(TestSuite[] suites)
|
|
||||||
{
|
|
||||||
writeResulStart(cast(int) suites.length);
|
|
||||||
foreach (ref TestSuite suite; suites)
|
|
||||||
{
|
|
||||||
foreach (ref Test test; suite.tests)
|
|
||||||
{
|
|
||||||
writeResult(suite, test);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
writeResulEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
string copyString(const char* str)
|
string copyString(const char* str)
|
||||||
{
|
{
|
||||||
auto length = strlen(str);
|
auto length = strlen(str);
|
||||||
|
|
@ -204,10 +110,9 @@ struct TestRunner(Args...)
|
||||||
write("Assert! File: ");
|
write("Assert! File: ");
|
||||||
write(test.file[0 .. $ - 1]);
|
write(test.file[0 .. $ - 1]);
|
||||||
write(":");
|
write(":");
|
||||||
write(test.fileLine);
|
write(test.file_line);
|
||||||
write(" Message: ");
|
write(" Message: ");
|
||||||
write(test.msg[0 .. $ - 1]);
|
write(test.msg[0 .. $ - 1]);
|
||||||
//write("\n");
|
|
||||||
write("</failure>\n");
|
write("</failure>\n");
|
||||||
}
|
}
|
||||||
write("\t\t</testcase>\n");
|
write("\t\t</testcase>\n");
|
||||||
|
|
@ -234,14 +139,14 @@ struct TestRunner(Args...)
|
||||||
else test.name = attributes[0];
|
else test.name = attributes[0];
|
||||||
|
|
||||||
// Save calling environment for longjmp
|
// Save calling environment for longjmp
|
||||||
int jmpRet = setjmp(gEnvBuffer);
|
int jmp_ret = setjmp(gEnvBuffer);
|
||||||
|
|
||||||
if (jmpRet == ASSERTED)
|
if (jmp_ret == ASSERTED)
|
||||||
{
|
{
|
||||||
passed = false;
|
passed = false;
|
||||||
test.passed = false;
|
test.passed = false;
|
||||||
test.file = copyString(gAssertInfo.file);
|
test.file = copyString(gAssertInfo.file);
|
||||||
test.fileLine = gAssertInfo.line;
|
test.file_line = gAssertInfo.line;
|
||||||
test.msg = copyString(gAssertInfo.msg);
|
test.msg = copyString(gAssertInfo.msg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -265,12 +170,10 @@ struct TestRunner(Args...)
|
||||||
auto file = fopen(OUT_FILE, "w");
|
auto file = fopen(OUT_FILE, "w");
|
||||||
fwrite(junit.data.ptr,junit.length,1,file);
|
fwrite(junit.data.ptr,junit.length,1,file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
//writeTests(suites);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeOutput()
|
void writeOutput()
|
||||||
{
|
{
|
||||||
import core.stdc.stdio;
|
|
||||||
foreach(ref TestSuite suite; suites)
|
foreach(ref TestSuite suite; suites)
|
||||||
{
|
{
|
||||||
printf("Suite: \"%s\" Passed: %u/%u\n", suite.name.ptr, suite.passed, suite.passed + suite.failed);
|
printf("Suite: \"%s\" Passed: %u/%u\n", suite.name.ptr, suite.passed, suite.passed + suite.failed);
|
||||||
|
|
@ -278,7 +181,7 @@ struct TestRunner(Args...)
|
||||||
{
|
{
|
||||||
if(!test.passed)
|
if(!test.passed)
|
||||||
{
|
{
|
||||||
printf("\tTest: \"%s\" Failed! Line: %u Message: %s\n",test.name.ptr, test.fileLine, test.msg.ptr);
|
printf("\tTest: \"%s\" Failed! Line: %u Message: %s\n",test.name.ptr, test.file_line, test.msg.ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue