no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / js / xpconnect / tests / components / native / xpctest_cenums.cpp
blobae72351b77f481630816633187c28e6f86e91b1c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* local header for xpconnect tests components */
9 #include "xpctest_private.h"
11 NS_IMPL_ISUPPORTS(xpcTestCEnums, nsIXPCTestCEnums)
13 // If this compiles, we pass. Otherwise, this means that XPIDL bitflag
14 // generation is broken.
15 xpcTestCEnums::xpcTestCEnums() {
16 static_assert(
17 0 == static_cast<uint32_t>(shouldBe0Implicit),
18 "XPIDL bitflag generation did not create correct shouldBe0Implicit flag");
19 static_assert(
20 1 == static_cast<uint32_t>(shouldBe1Implicit),
21 "XPIDL bitflag generation did not create correct shouldBe1Implicit flag");
22 static_assert(
23 2 == static_cast<uint32_t>(shouldBe2Implicit),
24 "XPIDL bitflag generation did not create correct shouldBe2Implicit flag");
25 static_assert(
26 3 == static_cast<uint32_t>(shouldBe3Implicit),
27 "XPIDL bitflag generation did not create correct shouldBe3Implicit flag");
28 static_assert(
29 5 == static_cast<uint32_t>(shouldBe5Implicit),
30 "XPIDL bitflag generation did not create correct shouldBe5Implicit flag");
31 static_assert(
32 6 == static_cast<uint32_t>(shouldBe6Implicit),
33 "XPIDL bitflag generation did not create correct shouldBe6Implicit flag");
34 static_assert(2 == static_cast<uint32_t>(shouldBe2AgainImplicit),
35 "XPIDL bitflag generation did not create correct "
36 "shouldBe2AgainImplicit flag");
37 static_assert(3 == static_cast<uint32_t>(shouldBe3AgainImplicit),
38 "XPIDL bitflag generation did not create correct "
39 "shouldBe3AgainImplicit flag");
40 static_assert(
41 1 == static_cast<uint32_t>(shouldBe1Explicit),
42 "XPIDL bitflag generation did not create correct shouldBe1Explicit flag");
43 static_assert(
44 2 == static_cast<uint32_t>(shouldBe2Explicit),
45 "XPIDL bitflag generation did not create correct shouldBe2Explicit flag");
46 static_assert(
47 4 == static_cast<uint32_t>(shouldBe4Explicit),
48 "XPIDL bitflag generation did not create correct shouldBe4Explicit flag");
49 static_assert(
50 8 == static_cast<uint32_t>(shouldBe8Explicit),
51 "XPIDL bitflag generation did not create correct shouldBe8Explicit flag");
52 static_assert(12 == static_cast<uint32_t>(shouldBe12Explicit),
53 "XPIDL bitflag generation did not create correct "
54 "shouldBe12Explicit flag");
57 nsresult xpcTestCEnums::TestCEnumInput(testFlagsExplicit a) {
58 if (a != shouldBe12Explicit) {
59 return NS_ERROR_FAILURE;
61 return NS_OK;
64 nsresult xpcTestCEnums::TestCEnumOutput(testFlagsExplicit* a) {
65 *a = shouldBe8Explicit;
66 return NS_OK;