]> git.saurik.com Git - apple/security.git/blame - SecurityTests/regressions/kc/kc-05-retain-release.c
Security-57337.60.2.tar.gz
[apple/security.git] / SecurityTests / regressions / kc / kc-05-retain-release.c
CommitLineData
d8f41ccd
A
1#include <stdlib.h>
2#include <Security/SecKeychain.h>
3
4#include "testmore.h"
5#include "testenv.h"
6
7int main(int argc, char *const *argv)
8{
9 plan_tests(8);
10
11 if (!tests_begin(argc, argv))
12 BAIL_OUT("tests_begin failed");
13
14 ok_status(SecKeychainSetUserInteractionAllowed(FALSE), "disable ui");
15 SecKeychainRef keychain = NULL;
16 ok_status(SecKeychainCreate("test", 4, "test", FALSE, NULL, &keychain),
17 "SecKeychainCreate");
18 SKIP: {
19 skip("can't continue without keychain", 2, ok(keychain, "keychain not NULL"));
20 ok_status(SecKeychainDelete(keychain), "SecKeychainDelete");
21
22 is_status(CFGetRetainCount(keychain), 1, "retaincount is 1");
23 CFRelease(keychain);
24 }
25
26 keychain = NULL;
27 ok_status(SecKeychainOpen("test", &keychain), "SecKeychainOpen");
28 SKIP: {
29 skip("can't continue without keychain", 2, ok(keychain, "keychain not NULL"));
30 CFIndex retCount = CFGetRetainCount(keychain);
31 is_status(retCount, 1, "retaincount is 1");
32 CFRelease(keychain);
33 }
34
35 return !tests_end(1);
36}