|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 #include <stdio.h> |
|
6 #include "plstr.h" |
|
7 #include "nsID.h" |
|
8 |
|
9 static const char* const ids[] = { |
|
10 "5C347B10-D55C-11D1-89B7-006008911B81", |
|
11 "{5C347B10-D55C-11D1-89B7-006008911B81}", |
|
12 "5c347b10-d55c-11d1-89b7-006008911b81", |
|
13 "{5c347b10-d55c-11d1-89b7-006008911b81}", |
|
14 |
|
15 "FC347B10-D55C-F1D1-F9B7-006008911B81", |
|
16 "{FC347B10-D55C-F1D1-F9B7-006008911B81}", |
|
17 "fc347b10-d55c-f1d1-f9b7-006008911b81", |
|
18 "{fc347b10-d55c-f1d1-f9b7-006008911b81}", |
|
19 }; |
|
20 #define NUM_IDS ((int) (sizeof(ids) / sizeof(ids[0]))) |
|
21 |
|
22 int main(int argc, char** argv) |
|
23 { |
|
24 nsID id; |
|
25 for (int i = 0; i < NUM_IDS; i++) { |
|
26 const char* idstr = ids[i]; |
|
27 if (!id.Parse(idstr)) { |
|
28 fprintf(stderr, "TestID: Parse failed on test #%d\n", i); |
|
29 return -1; |
|
30 } |
|
31 char* cp = id.ToString(); |
|
32 if (nullptr == cp) { |
|
33 fprintf(stderr, "TestID: ToString failed on test #%d\n", i); |
|
34 return -1; |
|
35 } |
|
36 if (0 != PL_strcmp(cp, ids[4*(i/4) + 3])) { |
|
37 fprintf(stderr, "TestID: compare of ToString failed on test #%d\n", i); |
|
38 return -1; |
|
39 } |
|
40 } |
|
41 |
|
42 return 0; |
|
43 } |