aboutsummaryrefslogtreecommitdiff
path: root/tests/src/confTest/confTest.cpp
blob: e1b5b7a2394a301ea9430549095a20f50c273353 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "catch2/2.0.1/catch.hpp"
#include "../../../include/Conf.hpp"

using namespace sibs;

TEST_CASE("parse config")
{
	SibsConfig sibsConfig(Compiler::GCC, TINYDIR_STRING("tests/src/confTest"));
    Result<bool> result = Config::readFromFile(TINYDIR_STRING("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");
}