]> git.saurik.com Git - apple/security.git/blob - Security/sec/SOSCircle/Regressions/sc-42-circlegencount.c
Security-57031.1.35.tar.gz
[apple/security.git] / Security / sec / SOSCircle / Regressions / sc-42-circlegencount.c
1 //
2 // sc-42-circlegencount.c
3 // sec
4 //
5 // Created by Richard Murphy on 9/10/14.
6 //
7 //
8
9
10
11
12 #include <Security/SecBase.h>
13 #include <Security/SecItem.h>
14 #include <Security/SecKey.h>
15
16 #include <SecureObjectSync/SOSCircle.h>
17 #include <SecureObjectSync/SOSCloudCircle.h>
18 #include <SecureObjectSync/SOSPeerInfo.h>
19 #include <SecureObjectSync/SOSInternal.h>
20 #include <SecureObjectSync/SOSUserKeygen.h>
21
22 #include <utilities/SecCFWrappers.h>
23
24 #include <CoreFoundation/CoreFoundation.h>
25
26 #include <stdlib.h>
27 #include <unistd.h>
28
29 #include <securityd/SOSCloudCircleServer.h>
30
31 #include "SOSCircle_regressions.h"
32
33 #include "SOSRegressionUtilities.h"
34
35 static int kTestTestCount = 5;
36 static void tests(void)
37 {
38 uint64_t beginvalue;
39 uint64_t incvalue;
40
41 SOSCircleRef circle = SOSCircleCreate(NULL, CFSTR("TEST DOMAIN"), NULL);
42
43 ok(NULL != circle, "Circle creation");
44
45 ok(0 == SOSCircleCountPeers(circle), "Zero peers");
46
47 ok(0 != (beginvalue = SOSCircleGetGenerationSint(circle))); // New circles should never be 0
48
49 SOSCircleGenerationSetValue(circle, 0);
50
51 ok(0 == SOSCircleGetGenerationSint(circle)); // Know we're starting out with a zero value (forced)
52
53 SOSCircleGenerationIncrement(circle);
54
55 ok(beginvalue < (incvalue = SOSCircleGetGenerationSint(circle))); // incremented value should be greater than where we began
56
57 CFReleaseNull(circle);
58 }
59
60 int sc_42_circlegencount(int argc, char *const *argv)
61 {
62 plan_tests(kTestTestCount);
63
64 tests();
65
66 return 0;
67 }