summaryrefslogtreecommitdiffstats
path: root/src/common/test/profile_test.cpp
blob: 65e20c5ddfdf82a82ae81581888ed745f9e7ae62 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "../profile.h"

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    CProfile profile;
    profile.InitCurrentDirectory(); // load colobot.ini file

    string result;
    profile.GetLocalProfileString("test_string", "string_value", result);
    if (result != "Hello world") {
        cout << "GetLocalProfileString failed!" << endl;
        return 1;
    }

    int int_value;
    profile.GetLocalProfileInt("test_int", "int_value", int_value);
    if (int_value != 42) {
        cout << "GetLocalProfileInt failed!" << endl;
        return 1;
    }

    float float_value;
    profile.GetLocalProfileFloat("test_float", "float_value", float_value);
    if (float_value != 1.5) {
        cout << "GetLocalProfileFloat failed!" << endl;
        return 1;
    }

    vector<string> list;
    list = profile.GetLocalProfileSection("test_multi", "entry");
    if (list.size() != 5) {
        cout << "GetLocalProfileSection failed!" << endl;
        return 1;
    }

    return 0;
}