1998-05-23 02:30:53 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2016-11-05 02:23:08 +03:00
|
|
|
|
1998-05-23 02:30:53 +04:00
|
|
|
#include "nsID.h"
|
|
|
|
|
2016-11-05 02:23:08 +03:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2001-11-07 09:24:10 +03:00
|
|
|
static const char* const ids[] = {
|
1998-05-23 02:30:53 +04:00
|
|
|
"5C347B10-D55C-11D1-89B7-006008911B81",
|
|
|
|
"{5C347B10-D55C-11D1-89B7-006008911B81}",
|
|
|
|
"5c347b10-d55c-11d1-89b7-006008911b81",
|
|
|
|
"{5c347b10-d55c-11d1-89b7-006008911b81}",
|
|
|
|
|
|
|
|
"FC347B10-D55C-F1D1-F9B7-006008911B81",
|
|
|
|
"{FC347B10-D55C-F1D1-F9B7-006008911B81}",
|
|
|
|
"fc347b10-d55c-f1d1-f9b7-006008911b81",
|
|
|
|
"{fc347b10-d55c-f1d1-f9b7-006008911b81}",
|
|
|
|
};
|
1999-10-22 18:51:41 +04:00
|
|
|
#define NUM_IDS ((int)(sizeof(ids) / sizeof(ids[0])))
|
1998-05-23 02:30:53 +04:00
|
|
|
|
2019-04-06 00:42:17 +03:00
|
|
|
TEST(nsID, StringConversion)
|
|
|
|
{
|
1998-05-23 02:30:53 +04:00
|
|
|
nsID id;
|
|
|
|
for (int i = 0; i < NUM_IDS; i++) {
|
2001-11-07 09:24:10 +03:00
|
|
|
const char* idstr = ids[i];
|
2016-11-05 02:23:08 +03:00
|
|
|
ASSERT_TRUE(id.Parse(idstr));
|
|
|
|
|
1998-05-23 02:30:53 +04:00
|
|
|
char* cp = id.ToString();
|
2016-11-05 02:23:08 +03:00
|
|
|
ASSERT_NE(cp, nullptr);
|
|
|
|
ASSERT_STREQ(cp, ids[4 * (i / 4) + 3]);
|
2016-11-04 09:00:47 +03:00
|
|
|
|
2016-11-05 02:23:08 +03:00
|
|
|
free(cp);
|
|
|
|
}
|
1998-05-23 02:30:53 +04:00
|
|
|
}
|