]>
git.saurik.com Git - apple/security.git/blob - OSX/sec/SOSCircle/Regressions/sc-42-circlegencount.c
2 // sc-42-circlegencount.c
5 // Created by Richard Murphy on 9/10/14.
12 #include <Security/SecBase.h>
13 #include <Security/SecItem.h>
14 #include <Security/SecKey.h>
16 #include <Security/SecureObjectSync/SOSCircle.h>
17 #include <Security/SecureObjectSync/SOSCloudCircle.h>
18 #include <Security/SecureObjectSync/SOSPeerInfo.h>
19 #include <Security/SecureObjectSync/SOSInternal.h>
20 #include <Security/SecureObjectSync/SOSUserKeygen.h>
22 #include <utilities/SecCFWrappers.h>
24 #include <CoreFoundation/CoreFoundation.h>
29 #include <securityd/SOSCloudCircleServer.h>
31 #include "SOSCircle_regressions.h"
33 #include "SOSRegressionUtilities.h"
35 static int kTestTestCount
= 7 ;
37 static void tests ( void )
43 SOSCircleRef circle
= SOSCircleCreate ( NULL
, CFSTR ( "TEST DOMAIN" ), NULL
);
45 ok ( NULL
!= circle
, "Circle creation" );
47 ok ( 0 == SOSCircleCountPeers ( circle
), "Zero peers" );
49 ok ( 0 != ( beginvalue
= SOSCircleGetGenerationSint ( circle
))); // New circles should never be 0
51 SOSCircleGenerationSetValue ( circle
, 0 );
53 ok ( 0 == SOSCircleGetGenerationSint ( circle
)); // Know we're starting out with a zero value (forced)
55 SOSCircleGenerationIncrement ( circle
);
57 ok ( beginvalue
<= ( newvalue
= SOSCircleGetGenerationSint ( circle
))); // incremented value should be greater or equal than where we began quantum is 2 seconds
60 SOSCircleGenerationIncrement ( circle
);
61 ok ( lastvalue
< ( newvalue
= SOSCircleGetGenerationSint ( circle
))); // incremented value should be greater than last
64 SOSCircleResetToEmpty ( circle
, NULL
);
65 ok ( lastvalue
< ( newvalue
= SOSCircleGetGenerationSint ( circle
))); // incremented value should be greater than last
67 CFReleaseNull ( circle
);
70 int sc_42_circlegencount ( int argc
, char * const * argv
)
72 plan_tests ( kTestTestCount
);