]>
git.saurik.com Git - apple/security.git/blob - keychain/SecureObjectSync/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 "keychain/SecureObjectSync/SOSCircle.h"
17 #include <Security/SecureObjectSync/SOSCloudCircle.h>
18 #include <Security/SecureObjectSync/SOSPeerInfo.h>
19 #include "keychain/SecureObjectSync/SOSInternal.h"
20 #include "keychain/SecureObjectSync/SOSUserKeygen.h"
22 #include <utilities/SecCFWrappers.h>
24 #include <CoreFoundation/CoreFoundation.h>
29 #include "keychain/securityd/SOSCloudCircleServer.h"
31 #include "SOSCircle_regressions.h"
33 #include "SOSRegressionUtilities.h"
36 static void tests ( void )
42 SOSCircleRef circle
= SOSCircleCreate ( NULL
, CFSTR ( "TEST DOMAIN" ), NULL
);
44 ok ( NULL
!= circle
, "Circle creation" );
46 ok ( 0 == SOSCircleCountPeers ( circle
), "Zero peers" );
48 ok ( 0 != ( beginvalue
= SOSCircleGetGenerationSint ( circle
))); // New circles should never be 0
50 SOSCircleGenerationSetValue ( circle
, 0 );
52 ok ( 0 == SOSCircleGetGenerationSint ( circle
)); // Know we're starting out with a zero value (forced)
54 SOSCircleGenerationIncrement ( circle
);
56 ok ( beginvalue
<= ( newvalue
= SOSCircleGetGenerationSint ( circle
))); // incremented value should be greater or equal than where we began quantum is 2 seconds
59 SOSCircleGenerationIncrement ( circle
);
60 ok ( lastvalue
< ( newvalue
= SOSCircleGetGenerationSint ( circle
))); // incremented value should be greater than last
63 SOSCircleResetToEmpty ( circle
, NULL
);
64 ok ( lastvalue
< ( newvalue
= SOSCircleGetGenerationSint ( circle
))); // incremented value should be greater than last
66 CFReleaseNull ( circle
);
70 int sc_42_circlegencount ( int argc
, char * const * argv
)