aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-01-06 09:38:59 +0100
committerdec05eba <dec05eba@protonmail.com>2018-01-06 09:41:18 +0100
commitad3b5099263e5977d1de9bfcff715a92009e8355 (patch)
treefd49aca56de6253efc4c2720423a65142bc4c150 /tests
parentea17671d7fe9ece8a33bdbc2f1d7bdf68bbccb69 (diff)
Add define.static, define.dynamic
Diffstat (limited to 'tests')
-rw-r--r--tests/src/confTest/confTest.cpp30
-rw-r--r--tests/src/confTest/defineDynamic.conf17
-rw-r--r--tests/src/confTest/defineStatic.conf17
3 files changed, 64 insertions, 0 deletions
diff --git a/tests/src/confTest/confTest.cpp b/tests/src/confTest/confTest.cpp
index 44bcab0..f3d9e2b 100644
--- a/tests/src/confTest/confTest.cpp
+++ b/tests/src/confTest/confTest.cpp
@@ -74,3 +74,33 @@ TEST_CASE("parse config - use different config for different platforms")
#endif
#endif
}
+
+TEST_CASE("parse config - define static")
+{
+ SibsConfig sibsConfig(Compiler::GCC, TINYDIR_STRING("tests/src/confTest"), OPT_LEV_DEBUG, false);
+ Result<bool> result = Config::readFromFile(TINYDIR_STRING("tests/src/confTest/defineStatic.conf"), sibsConfig);
+ if(result.isErr())
+ {
+ fprintf(stderr, "%s", result.getErrMsg().c_str());
+ exit(1);
+ }
+
+ REQUIRE(sibsConfig.getDefinedValue("GLOBAL_DEFINE") == "1");
+ REQUIRE(sibsConfig.getDefinedValue("BUILD_STATIC") == "1");
+ REQUIRE(sibsConfig.getDefinedValue("DEFINE_TYPE") == "STATIC");
+}
+
+TEST_CASE("parse config - define dynamic")
+{
+ SibsConfig sibsConfig(Compiler::GCC, TINYDIR_STRING("tests/src/confTest"), OPT_LEV_DEBUG, false);
+ Result<bool> result = Config::readFromFile(TINYDIR_STRING("tests/src/confTest/defineDynamic.conf"), sibsConfig);
+ if(result.isErr())
+ {
+ fprintf(stderr, "%s", result.getErrMsg().c_str());
+ exit(1);
+ }
+
+ REQUIRE(sibsConfig.getDefinedValue("GLOBAL_DEFINE") == "1");
+ REQUIRE(sibsConfig.getDefinedValue("BUILD_STATIC") == "0");
+ REQUIRE(sibsConfig.getDefinedValue("DEFINE_TYPE") == "DYNAMIC");
+}
diff --git a/tests/src/confTest/defineDynamic.conf b/tests/src/confTest/defineDynamic.conf
new file mode 100644
index 0000000..fb08e5c
--- /dev/null
+++ b/tests/src/confTest/defineDynamic.conf
@@ -0,0 +1,17 @@
+[package]
+name = "glew"
+version = "2.1.0"
+type = "dynamic"
+platforms = ["any"]
+
+[define]
+GLOBAL_DEFINE = "1"
+DEFINE_TYPE = "GLOBAL"
+
+[define.static]
+BUILD_STATIC = "1"
+DEFINE_TYPE = "STATIC"
+
+[define.dynamic]
+BUILD_STATIC = "0"
+DEFINE_TYPE = "DYNAMIC"
diff --git a/tests/src/confTest/defineStatic.conf b/tests/src/confTest/defineStatic.conf
new file mode 100644
index 0000000..8ec0d8c
--- /dev/null
+++ b/tests/src/confTest/defineStatic.conf
@@ -0,0 +1,17 @@
+[package]
+name = "glew"
+version = "2.1.0"
+type = "static"
+platforms = ["any"]
+
+[define]
+GLOBAL_DEFINE = "1"
+DEFINE_TYPE = "GLOBAL"
+
+[define.static]
+BUILD_STATIC = "1"
+DEFINE_TYPE = "STATIC"
+
+[define.dynamic]
+BUILD_STATIC = "0"
+DEFINE_TYPE = "DYNAMIC"