2
2
test_cfg.c - simple test for the cfg module
3
3
This file is part of the nss-pam-ldapd library.
5
Copyright (C) 2007, 2009 Arthur de Jong
5
Copyright (C) 2007, 2009, 2011 Arthur de Jong
7
7
This library is free software; you can redistribute it and/or
8
8
modify it under the terms of the GNU Lesser General Public
26
26
#include <string.h>
27
27
#include <assert.h>
29
31
/* we include cfg.c because we want to test the static methods */
30
32
#include "nslcd/cfg.c"
32
#ifndef __ASSERT_FUNCTION
33
#define __ASSERT_FUNCTION ""
34
#endif /* not __ASSERT_FUNCTION */
36
#define assertstreq(str1,str2) \
37
(assertstreq_impl(str1,str2,"strcmp(" __STRING(str1) "," __STRING(str2) ")==0", \
38
__FILE__, __LINE__, __ASSERT_FUNCTION))
41
#define __assert_fail(assertion,file,line,function) __assert(assertion,file,line)
43
/* method for determening string equalness */
44
static void assertstreq_impl(const char *str1,const char *str2,
45
const char *assertion,const char *file,
46
int line,const char *function)
48
if (strcmp(str1,str2)!=0)
49
__assert_fail(assertion,file,line,function);
52
34
static void test_xstrdup(void)
54
36
static const char *foo="testString123";
101
83
assert(parse_boolean(__FILE__,__LINE__,"Foo")==0); */
105
86
static void test_parse_scope(void)
107
88
assert(parse_scope(__FILE__,__LINE__,"sUb")==LDAP_SCOPE_SUBTREE);