]> gitweb.factorcode.org Git - factor.git/blob - unmaintained/ldap/ldap-tests.factor
tools.test: Make the flag public. Finish porting tester changes to fuzzer.
[factor.git] / unmaintained / ldap / ldap-tests.factor
1 USING: alien alien.c-types io kernel ldap ldap.libldap
2 namespaces prettyprint tools.test ;
3 IN: ldap.tests
4
5 "void*" <c-object> "ldap://localhost:389" initialize
6
7 get-ldp LDAP_OPT_PROTOCOL_VERSION LDAP_VERSION3 <int> set-option
8
9 [ 3 ] [
10     get-ldp LDAP_OPT_PROTOCOL_VERSION "int*" <c-object> [ get-option ] keep
11     *int
12 ] unit-test
13
14 [
15     get-ldp "cn=jimbob,dc=example,dc=com" "secret" [
16
17         ! get-ldp "dc=example,dc=com" LDAP_SCOPE_ONELEVEL "(objectclass=*)" f 0
18         ! "void*" <c-object> [ search-s ] keep *int .
19
20         [ 2 ] [
21             get-ldp "dc=example,dc=com" LDAP_SCOPE_SUBTREE "(objectclass=*)" f 0
22             search
23         ] unit-test
24
25         ! get-ldp LDAP_RES_ANY 0 f "void*" <c-object> result .
26
27         get-ldp LDAP_RES_ANY LDAP_MSG_ALL f "void*" <c-object> result
28
29         ! get-message *int .
30
31         "Message ID: " write
32
33         get-message msgid .
34
35         get-ldp get-message get-dn .
36
37         "Entries count: " write
38
39         get-ldp get-message count-entries .
40
41         SYMBOL: entry
42         SYMBOL: attr
43
44         "Attribute: " write
45
46         get-ldp get-message first-entry entry set get-ldp entry get
47         "void*" <c-object> first-attribute dup . attr set
48
49         "Value: " write
50
51         get-ldp entry get attr get get-values *char* .
52
53         get-ldp get-message first-message msgtype result-type
54
55         get-ldp get-message next-message msgtype result-type
56
57     ] with-bind
58 ] drop