@@ -22,28 +22,7 @@ target_link_libraries(libswan ${libraries}) | |||
install(TARGETS libswan DESTINATION swan/libswan) | |||
add_executable(test_libswan EXCLUDE_FROM_ALL | |||
test/lib/test.cc | |||
test/Animation.t.cc | |||
test/Body.t.cc | |||
test/BoundingBox.t.cc | |||
test/Clock.t.cc | |||
test/common.t.cc | |||
test/Entity.t.cc | |||
test/Game.t.cc | |||
test/Item.t.cc | |||
test/Mod.t.cc | |||
test/OS.t.cc | |||
test/Resource.t.cc | |||
test/SRF.t.cc | |||
test/swan.t.cc | |||
test/Tile.t.cc | |||
test/util.t.cc | |||
test/log.t.cc | |||
test/Vector2.t.cc | |||
test/Win.t.cc | |||
test/World.t.cc | |||
test/WorldGen.t.cc | |||
test/WorldPlane.t.cc) | |||
test/lib/test.cc) | |||
target_link_libraries(test_libswan libswan) | |||
target_include_directories(test_libswan | |||
PRIVATE "include/swan") |
@@ -1,3 +0,0 @@ | |||
#include "Animation.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "Body.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "BoundingBox.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "Clock.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "Entity.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "Game.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "Item.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "Mod.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "OS.h" | |||
#include "lib/test.h" |
@@ -1,5 +0,0 @@ | |||
#include "PerfCounter.h" | |||
#include "lib/test.h" | |||
test("") |
@@ -1,3 +0,0 @@ | |||
#include "Resource.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "SRF.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "Tile.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "Vector2.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "Win.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "World.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "WorldGen.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "WorldPlane.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "common.h" | |||
#include "lib/test.h" |
@@ -1,3 +0,0 @@ | |||
#include "gfxutil.h" | |||
#include "lib/test.h" |
@@ -1,12 +0,0 @@ | |||
#include "log.h" | |||
#include <sstream> | |||
#include "lib/test.h" | |||
test("Basic logging") { | |||
std::stringstream ostream; | |||
Swan::Logger log(ostream, "test"); | |||
log << "Hello World, a number: " << 100 << ", and a string"; | |||
expecteq(ostream.str(), "test: Hello World, a number: 100, and a string\n"); | |||
} |
@@ -1,3 +0,0 @@ | |||
#include "swan.h" | |||
#include "lib/test.h" |
@@ -1,37 +0,0 @@ | |||
#include "util.h" | |||
#include "lib/test.h" | |||
test("Deferred functions run") { | |||
int runs = 0; | |||
{ | |||
auto def = Swan::makeDeferred([&] { runs += 1; }); | |||
expecteq(runs, 0); | |||
} | |||
expecteq(runs, 1); | |||
} | |||
test("Moved deferreds don't run") { | |||
int runs = 0; | |||
{ | |||
auto def = Swan::makeDeferred([&] { runs += 1; }); | |||
auto def2 = std::move(def); | |||
expecteq(runs, 0); | |||
} | |||
expecteq(runs, 1); | |||
} | |||
test("Raii pointers") { | |||
int runs = 0; | |||
{ | |||
auto ptr = Swan::makeRaiiPtr(new int(10), [&](int *p) { | |||
runs += 1; | |||
delete p; | |||
}); | |||
expecteq(runs, 0); | |||
expectneq(ptr, nullptr); | |||
expecteq(*ptr, 10); | |||
} | |||
expecteq(runs, 1); | |||
} |