aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2017-12-29 00:08:56 +0100
committerdec05eba <dec05eba@protonmail.com>2017-12-29 00:09:05 +0100
commit948666962cc0a5757d147b295ab526674636fac3 (patch)
tree3c57a9f82815e8fc3d3e9966d9d12324bee7f3fd /tests
parent179c5baaa2b24be61f65daad0e4d415914af4c71 (diff)
Add parse config test
Diffstat (limited to 'tests')
-rw-r--r--tests/src/confTest/confTest.cpp26
-rw-r--r--tests/src/confTest/project.conf8
-rw-r--r--tests/src/function.cpp6
3 files changed, 34 insertions, 6 deletions
diff --git a/tests/src/confTest/confTest.cpp b/tests/src/confTest/confTest.cpp
new file mode 100644
index 0000000..38b4971
--- /dev/null
+++ b/tests/src/confTest/confTest.cpp
@@ -0,0 +1,26 @@
+#include "catch2/0.1.0/catch.hpp"
+#include "../../../include/Conf.hpp"
+
+using namespace sibs;
+
+TEST_CASE("parse config")
+{
+ SibsConfig sibsConfig("tests/src/confTest");
+ Result<bool> result = Config::readFromFile("tests/src/confTest/project.conf", sibsConfig);
+ if(result.isErr())
+ {
+ fprintf(stderr, "%s", result.getErrMsg().c_str());
+ exit(1);
+ }
+ REQUIRE(sibsConfig.getPackageName() == "confTest");
+ REQUIRE(sibsConfig.getPackageType() == PackageType::LIBRARY);
+ REQUIRE(sibsConfig.getDependencies().size() == 2);
+
+ const auto &xxhashDependency = sibsConfig.getDependencies()[0];
+ REQUIRE(xxhashDependency.name == "xxhash");
+ REQUIRE(xxhashDependency.version == "0.1.0");
+
+ const auto &catch2Dependency = sibsConfig.getDependencies()[1];
+ REQUIRE(catch2Dependency.name == "catch2");
+ REQUIRE(catch2Dependency.version == "1.0.0");
+}
diff --git a/tests/src/confTest/project.conf b/tests/src/confTest/project.conf
new file mode 100644
index 0000000..e50ad9c
--- /dev/null
+++ b/tests/src/confTest/project.conf
@@ -0,0 +1,8 @@
+[package]
+name = "confTest"
+version = "0.1.0"
+type = "library"
+
+[dependencies]
+xxhash = "0.1.0"
+catch2 = "1.0.0"
diff --git a/tests/src/function.cpp b/tests/src/function.cpp
deleted file mode 100644
index 5f14f33..0000000
--- a/tests/src/function.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "catch2/0.1.0/catch.hpp"
-
-TEST_CASE("dummy")
-{
-
-}