Bug 1869647 - Mark hasStorageAccess.sub.https.window.html as intermittent after wpt...
[gecko.git] / mfbt / tests / TestArray.cpp
blobff41001e0a215a8d01b56f9e93b6fd8efc85c85b
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/Array.h"
9 void TestInitialValueByConstructor() {
10 using namespace mozilla;
11 // Style 1
12 Array<int32_t, 3> arr1(1, 2, 3);
13 MOZ_RELEASE_ASSERT(arr1[0] == 1);
14 MOZ_RELEASE_ASSERT(arr1[1] == 2);
15 MOZ_RELEASE_ASSERT(arr1[2] == 3);
16 // Style 2
17 Array<int32_t, 3> arr2{5, 6, 7};
18 MOZ_RELEASE_ASSERT(arr2[0] == 5);
19 MOZ_RELEASE_ASSERT(arr2[1] == 6);
20 MOZ_RELEASE_ASSERT(arr2[2] == 7);
21 // Style 3
22 Array<int32_t, 3> arr3({8, 9, 10});
23 MOZ_RELEASE_ASSERT(arr3[0] == 8);
24 MOZ_RELEASE_ASSERT(arr3[1] == 9);
25 MOZ_RELEASE_ASSERT(arr3[2] == 10);
28 int main() {
29 TestInitialValueByConstructor();
30 return 0;