tests/core: Update tags/generic test to the new framework

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-08-27 09:04:21 -04:00
parent 0dd91e25c7
commit a6d206a003
3 changed files with 27 additions and 13 deletions

View File

@ -2,14 +2,15 @@
import os
Import("env", "UnitTest")
objs = []
core_objs = []
def CoreTest(name, source):
global objs
global core_objs
if os.path.exists("../../core/%s" % source):
objs += [ env.Object("../../core/%s" % source) ]
run = UnitTest("core/%s" % name, [ source ] + objs)
core_objs += [ env.Object("../../core/%s" % source) ]
run = UnitTest("core/%s" % name, [ source ] + core_objs)
Alias("tests/core", run)
return run
Export("core_objs")
res = [ CoreTest("version", "version.c") ]
@ -19,10 +20,10 @@ res += [ CoreTest("database", "database.cpp") ]
res += [ CoreTest("index", "index.cpp") ]
res += [ CoreTest("filter", "filter.cpp") ]
res += [ CoreTest("idle", "idle.cpp") ]
res += SConscript("tags/Sconscript")
Return("res")
#
#test( "tags/generic" )
#test( "tags/artist" )
#test( "tags/album" )
#test( "tags/genre" )

View File

@ -0,0 +1,15 @@
#!/usr/bin/python
import os
Import("env", "UnitTest", "core_objs")
def TagTest(name, source):
global core_objs
if os.path.exists("../../../core/tags/%s" % source):
core_objs += [ env.Object("../../../core/tags/%s" % source) ]
run = UnitTest("core/tags/%s" % name, [ source ] + core_objs)
Alias("tests/core", run)
Alias("tests/core/tags", run)
return run
res = [ TagTest("generic", "generic.cpp") ]
Return("res")

View File

@ -2,7 +2,7 @@
* Copyright 2014 (c) Anna Schumaker.
*/
#include <core/tags/generic.h>
#include <tests/test.h>
#include "../test.h"
static void test_generic_tag()
{
@ -49,9 +49,7 @@ static void test_generic_tag_comparison()
test_equal(A.compare(&empty), -1);
}
int main(int argc, char **argv)
{
test :: run("Generic Tag Test", test_generic_tag);
test :: run("Generic Tag Compare Test", test_generic_tag_comparison);
return 0;
}
DECLARE_UNIT_TESTS(
UNIT_TEST("Generic Tag", test_generic_tag),
UNIT_TEST("Generic Tag Comparison", test_generic_tag_comparison),
);