Alex 'AdUser' Z
9 years ago
4 changed files with 42 additions and 0 deletions
@ -0,0 +1,6 @@
|
||||
enable_testing() |
||||
|
||||
set(SRC_DIR "../src") |
||||
|
||||
add_executable("parse_config" "${SRC_DIR}/config.c" "parse_config.c") |
||||
add_test("parse_config" "parse_config") |
@ -0,0 +1,26 @@
|
||||
#include <assert.h> |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
|
||||
#include "../src/config.h" |
||||
|
||||
int main(void) { |
||||
oal_config_t config; |
||||
|
||||
memset(&config, 0x0, sizeof(oal_config_t)); |
||||
|
||||
if (parse_config(&config, "test.conf") != 0) { |
||||
fputs(config.error, stderr); |
||||
return 1; |
||||
} |
||||
|
||||
assert(config.bindtimeout == 5); |
||||
assert(strcmp(config.bindpass, "strong-password") == 0); |
||||
assert(strcmp(config.bindurls, "ldap://127.0.0.1 ldaps://172.16.17.1") == 0); |
||||
assert(strcmp(config.binddn, "cn=admin,dc=example,dc=com") == 0); |
||||
assert(strcmp(config.basedn, "ou=users,dc=example,dc=com") == 0); |
||||
assert(strcmp(config.userfilter, "(objectClass=inetOrgPerson)") == 0); |
||||
|
||||
return 0; |
||||
} |
Loading…
Reference in new issue