Bug 1883861 - Part 1: Move visitMemoryBarrier into the common CodeGenerator file...
[gecko.git] / xpcom / tests / gtest / TestID.cpp
blob65b41a2b265badf930438ce17a68fc6f52724c89
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/. */
6 #include "nsID.h"
8 #include "gtest/gtest.h"
10 static const char* const ids[] = {
11 "5C347B10-D55C-11D1-89B7-006008911B81",
12 "{5C347B10-D55C-11D1-89B7-006008911B81}",
13 "5c347b10-d55c-11d1-89b7-006008911b81",
14 "{5c347b10-d55c-11d1-89b7-006008911b81}",
16 "FC347B10-D55C-F1D1-F9B7-006008911B81",
17 "{FC347B10-D55C-F1D1-F9B7-006008911B81}",
18 "fc347b10-d55c-f1d1-f9b7-006008911b81",
19 "{fc347b10-d55c-f1d1-f9b7-006008911b81}",
21 #define NUM_IDS ((int)(sizeof(ids) / sizeof(ids[0])))
23 TEST(nsID, StringConversion)
25 nsID id;
26 for (int i = 0; i < NUM_IDS; i++) {
27 const char* idstr = ids[i];
28 ASSERT_TRUE(id.Parse(idstr));
30 auto cp = id.ToString();
31 ASSERT_STREQ(cp.get(), ids[4 * (i / 4) + 3]);