Some preformance tests and added EntityMeta structure
This commit is contained in:
parent
4bd5a37b5d
commit
f6e7af1014
4 changed files with 385 additions and 20 deletions
|
|
@ -9,8 +9,19 @@ import bubel.ecs.vector;
|
|||
import bubel.ecs.simple_vector;
|
||||
import bubel.ecs.std;
|
||||
|
||||
import std.traits;
|
||||
|
||||
import tests.time;
|
||||
|
||||
version (LDC)
|
||||
{
|
||||
import ldc.attributes;
|
||||
}
|
||||
else
|
||||
{
|
||||
enum optStrategy = 0;
|
||||
}
|
||||
|
||||
enum int ASSERTED = 123;
|
||||
enum string OUT_FILE = "test_report.xml";
|
||||
|
||||
|
|
@ -124,42 +135,65 @@ struct TestRunner(Args...)
|
|||
write("</testsuites>");
|
||||
}
|
||||
|
||||
@(optStrategy,"none")
|
||||
void runTests(string[] include = null, string[] exclude = null)
|
||||
{
|
||||
foreach (i, module_; Args)
|
||||
{
|
||||
TestSuite* suite = &suites[i];
|
||||
suite.name = module_.stringof;
|
||||
|
||||
void function() before;
|
||||
void function() after;
|
||||
|
||||
foreach (index, unittest_; __traits(getUnitTests, module_))
|
||||
{
|
||||
enum attributes = __traits(getAttributes, unittest_);
|
||||
|
||||
static if (attributes.length != 0)
|
||||
{
|
||||
if (include.length > 0)
|
||||
foreach(attr_id, attr; attributes)
|
||||
{
|
||||
bool matched = false;
|
||||
foreach (str; include)
|
||||
static if(isFunctionPointer!(attr)){}
|
||||
else static if(attr == "_tr_before")
|
||||
{
|
||||
if (match(str, attributes[0]))
|
||||
{
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
static assert(attr_id+1 < attributes.length);
|
||||
enum attr2 = attributes[attr_id + 1];
|
||||
//static assert(__traits(hasMember, module_, attr2));
|
||||
//alias func = __traits(getMember, module_, attr2);
|
||||
//attr2();
|
||||
before = attr2;
|
||||
//static assert(is(typeof(__traits(getMember, module_, attr2)) == void function()));
|
||||
}
|
||||
|
||||
foreach (str; exclude)
|
||||
else
|
||||
{
|
||||
if (match(str, attributes[0]))
|
||||
if (include.length > 0)
|
||||
{
|
||||
matched = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool matched = false;
|
||||
foreach (str; include)
|
||||
{
|
||||
if (match(str, attr))
|
||||
{
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
{
|
||||
suite.skipped++;
|
||||
continue;
|
||||
foreach (str; exclude)
|
||||
{
|
||||
if (match(str, attr))
|
||||
{
|
||||
matched = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
{
|
||||
suite.skipped++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -178,6 +212,7 @@ struct TestRunner(Args...)
|
|||
|
||||
static if (__traits(hasMember, module_, "beforeEveryTest"))
|
||||
module_.beforeEveryTest();
|
||||
if(before)before();
|
||||
|
||||
version(D_BetterC)
|
||||
{
|
||||
|
|
@ -318,6 +353,8 @@ version (notBetterC)
|
|||
version (D_Coverage) extern (C) void dmd_coverDestPath(string path);
|
||||
}
|
||||
|
||||
enum before = "_tr_before";
|
||||
|
||||
void extractStrings(ref Vector!string container, string str)
|
||||
{
|
||||
uint s = 0;
|
||||
|
|
@ -383,7 +420,7 @@ extern (C) int main(int argc, char** args)
|
|||
}
|
||||
}
|
||||
|
||||
TestRunner!(tests.runner, tests.id_manager, tests.vector, tests.basic) runner;
|
||||
TestRunner!(tests.id_manager, tests.vector, tests.basic, tests.perf, tests.access_perf) runner;
|
||||
|
||||
runner.runTests(include[], exclude[]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue