/***
This file is part of systemd.
Copyright 2015 Ronny Chevalier
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "conf-parser.h"
#include "log.h"
#include "macro.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
assert_se(config_parse_path("unit", "filename", 1, "section", 1, "lvalue", 0, rvalue, &path, NULL) >= 0);
}
int log_level = 0;
assert_se(config_parse_log_level("unit", "filename", 1, "section", 1, "lvalue", 0, rvalue, &log_level, NULL) >= 0);
}
int log_facility = 0;
assert_se(config_parse_log_facility("unit", "filename", 1, "section", 1, "lvalue", 0, rvalue, &log_facility, NULL) >= 0);
}
assert_se(config_parse_iec_size("unit", "filename", 1, "section", 1, "lvalue", 0, rvalue, &iec_size, NULL) >= 0);
}
assert_se(config_parse_si_size("unit", "filename", 1, "section", 1, "lvalue", 0, rvalue, &si_size, NULL) >= 0);
}
int v = -1;
assert_se(config_parse_int("unit", "filename", 1, "section", 1, "lvalue", 0, rvalue, &v, NULL) >= 0);
}
unsigned v = 0;
assert_se(config_parse_unsigned("unit", "filename", 1, "section", 1, "lvalue", 0, rvalue, &v, NULL) >= 0);
}
char **strv = 0;
assert_se(config_parse_strv("unit", "filename", 1, "section", 1, "lvalue", 0, rvalue, &strv, NULL) >= 0);
}
mode_t v = 0;
assert_se(config_parse_mode("unit", "filename", 1, "section", 1, "lvalue", 0, rvalue, &v, NULL) >= 0);
}
usec_t v = 0;
assert_se(config_parse_sec("unit", "filename", 1, "section", 1, "lvalue", 0, rvalue, &v, NULL) >= 0);
}
nsec_t v = 0;
assert_se(config_parse_nsec("unit", "filename", 1, "nsection", 1, "lvalue", 0, rvalue, &v, NULL) >= 0);
}
static void test_config_parse_path(void) {
}
static void test_config_parse_log_level(void) {
test_config_parse_log_level_one("garbage", 0);
}
static void test_config_parse_log_facility(void) {
test_config_parse_log_facility_one("garbage", 0);
}
static void test_config_parse_iec_size(void) {
test_config_parse_iec_size_one("0G", 0);
test_config_parse_iec_size_one("0", 0);
test_config_parse_iec_size_one("-982", 0);
test_config_parse_iec_size_one("49874444198739873000000G", 0);
test_config_parse_iec_size_one("garbage", 0);
}
static void test_config_parse_si_size(void) {
test_config_parse_si_size_one("0G", 0);
test_config_parse_si_size_one("0", 0);
test_config_parse_si_size_one("-982", 0);
test_config_parse_si_size_one("49874444198739873000000G", 0);
test_config_parse_si_size_one("garbage", 0);
}
static void test_config_parse_int(void) {
test_config_parse_int_one("0", 0);
}
static void test_config_parse_unsigned(void) {
test_config_parse_unsigned_one("0", 0);
test_config_parse_unsigned_one("99999999999999999999999999999999999999999999999999999999", 0);
test_config_parse_unsigned_one("1G", 0);
test_config_parse_unsigned_one("garbage", 0);
test_config_parse_unsigned_one("1000garbage", 0);
}
static void test_config_parse_strv(void) {
}
static void test_config_parse_mode(void) {
test_config_parse_mode_one("-777", 0);
test_config_parse_mode_one("999", 0);
test_config_parse_mode_one("garbage", 0);
test_config_parse_mode_one("777garbage", 0);
test_config_parse_mode_one("777 garbage", 0);
}
static void test_config_parse_sec(void) {
test_config_parse_sec_one("-1", 0);
test_config_parse_sec_one("10foo", 0);
test_config_parse_sec_one("garbage", 0);
}
static void test_config_parse_nsec(void) {
test_config_parse_nsec_one("-1", 0);
test_config_parse_nsec_one("10foo", 0);
test_config_parse_nsec_one("garbage", 0);
}
log_open();
return 0;
}