This repository was archived by the owner on Jan 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathtestDb.c
53 lines (48 loc) · 1.56 KB
/
testDb.c
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
44
45
46
47
48
49
50
51
52
53
/*
* BitMeterOS
* http://codebox.org.uk/bitmeterOS
*
* Copyright (c) 2011 Rob Dawson
*
* Licensed under the GNU General Public License
* http://www.gnu.org/licenses/gpl.txt
*
* This file is part of BitMeterOS.
*
* BitMeterOS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* BitMeterOS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BitMeterOS. If not, see <http://www.gnu.org/licenses/>.
*/
#include "test.h"
#include "common.h"
#include <string.h>
#include <stdlib.h>
#include "CuTest.h"
/*
Contains unit tests for the 'db' module.
*/
void testGetConfigInt(CuTest *tc){
CuAssertIntEquals(tc, -1, getConfigInt("config.int", TRUE));
addConfigRow("config.int", "7");
CuAssertIntEquals(tc, 7, getConfigInt("config.int", TRUE));
}
void testGetConfigText(CuTest *tc){
CuAssertTrue(tc, getConfigText("config.txt", TRUE) == NULL);
addConfigRow("config.txt", "text");
CuAssertStrEquals(tc, "text", getConfigText("config.txt", TRUE));
}
CuSuite* dbGetSuite() {
CuSuite* suite = CuSuiteNew();
SUITE_ADD_TEST(suite, testGetConfigInt);
SUITE_ADD_TEST(suite, testGetConfigText);
return suite;
}