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() {
17 0 == static_cast<uint32_t>(shouldBe0Implicit
),
18 "XPIDL bitflag generation did not create correct shouldBe0Implicit flag");
20 1 == static_cast<uint32_t>(shouldBe1Implicit
),
21 "XPIDL bitflag generation did not create correct shouldBe1Implicit flag");
23 2 == static_cast<uint32_t>(shouldBe2Implicit
),
24 "XPIDL bitflag generation did not create correct shouldBe2Implicit flag");
26 3 == static_cast<uint32_t>(shouldBe3Implicit
),
27 "XPIDL bitflag generation did not create correct shouldBe3Implicit flag");
29 5 == static_cast<uint32_t>(shouldBe5Implicit
),
30 "XPIDL bitflag generation did not create correct shouldBe5Implicit flag");
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");
41 1 == static_cast<uint32_t>(shouldBe1Explicit
),
42 "XPIDL bitflag generation did not create correct shouldBe1Explicit flag");
44 2 == static_cast<uint32_t>(shouldBe2Explicit
),
45 "XPIDL bitflag generation did not create correct shouldBe2Explicit flag");
47 4 == static_cast<uint32_t>(shouldBe4Explicit
),
48 "XPIDL bitflag generation did not create correct shouldBe4Explicit flag");
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
;
64 nsresult
xpcTestCEnums::TestCEnumOutput(testFlagsExplicit
* a
) {
65 *a
= shouldBe8Explicit
;