PageRenderTime 1611ms CodeModel.GetById 15ms RepoModel.GetById 30ms app.codeStats 0ms

/core/externals/update-engine/Common/KSUUIDTest.m

http://macfuse.googlecode.com/
Objective C | 46 lines | 19 code | 11 blank | 16 comment | 0 complexity | ff2a0d8138ea1cf1a550dd350cca89b9 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, GPL-2.0
  1. // Copyright 2008 Google Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <SenTestingKit/SenTestingKit.h>
  15. #import "KSUUID.h"
  16. @interface KSUUIDTest : SenTestCase
  17. @end
  18. @implementation KSUUIDTest
  19. - (void)testBasics {
  20. // Make sure we get a reasonable looking string;
  21. NSString *uuid1 = [KSUUID uuidString];
  22. // Make sure there's character groupings of 8-4-4-4-12
  23. NSArray *chunks;
  24. chunks = [uuid1 componentsSeparatedByString:@"-"];
  25. STAssertEquals([chunks count], 5U, nil);
  26. STAssertEquals([[chunks objectAtIndex:0] length], 8U, nil);
  27. STAssertEquals([[chunks objectAtIndex:1] length], 4U, nil);
  28. STAssertEquals([[chunks objectAtIndex:2] length], 4U, nil);
  29. STAssertEquals([[chunks objectAtIndex:3] length], 4U, nil);
  30. STAssertEquals([[chunks objectAtIndex:4] length], 12U, nil);
  31. // Make sure we don't just keep getting the same string.
  32. NSString *uuid2 = [KSUUID uuidString];
  33. STAssertFalse([uuid1 isEqualToString:uuid2], nil);
  34. }
  35. @end