test_config.cpp 1.15 KB
Newer Older
1
#include "catch.hpp"
2
#include "common/config.h"
3
4

TEST_CASE( "Read in Config Template" ) {
Steffen Schotthöfer's avatar
Steffen Schotthöfer committed
5
    std::string filename = std::string( TESTS_PATH ) + "input/unit_tests/common/unit_config.cfg";
6
7

    // Load Settings from File
steffen.schotthoefer's avatar
steffen.schotthoefer committed
8
    Config* config = new Config( filename );
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

    // Test all set configurations
    bool allSatisfied = true;

    if( config->GetCFL() != 0.4 ) allSatisfied = false;
    if( config->GetTEnd() != 0.3 ) allSatisfied = false;

    if( config->GetProblemName() != PROBLEM_LineSource ) allSatisfied = false;
    if( config->GetKernelName() != KERNEL_Isotropic ) allSatisfied = false;
    if( config->GetQuadName() != QUAD_MonteCarlo ) allSatisfied = false;

    if( config->GetQuadOrder() != 5000 ) allSatisfied = false;

    // Check boundary conditions
    if( config->GetBoundaryType( "DirichletTestMarker2" ) != DIRICHLET ) allSatisfied = false;
    if( config->GetBoundaryType( "DirichletTestMarker1" ) != DIRICHLET ) allSatisfied = false;
    if( config->GetBoundaryType( "NeumannTestMarker1" ) != NEUMANN ) allSatisfied = false;
    if( config->GetBoundaryType( "NeumannTestMarker2" ) != NEUMANN ) allSatisfied = false;

    REQUIRE( allSatisfied );
}