summaryrefslogtreecommitdiff
path: root/Tests/AK
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/AK')
-rw-r--r--Tests/AK/CMakeLists.txt1
-rw-r--r--Tests/AK/TestFixedArray.cpp29
2 files changed, 30 insertions, 0 deletions
diff --git a/Tests/AK/CMakeLists.txt b/Tests/AK/CMakeLists.txt
index 346165afd0..8459a55706 100644
--- a/Tests/AK/CMakeLists.txt
+++ b/Tests/AK/CMakeLists.txt
@@ -21,6 +21,7 @@ set(AK_TEST_SOURCES
TestEndian.cpp
TestEnumBits.cpp
TestFind.cpp
+ TestFixedArray.cpp
TestFormat.cpp
TestGenericLexer.cpp
TestHashFunctions.cpp
diff --git a/Tests/AK/TestFixedArray.cpp b/Tests/AK/TestFixedArray.cpp
new file mode 100644
index 0000000000..6b33818c62
--- /dev/null
+++ b/Tests/AK/TestFixedArray.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibTest/TestSuite.h>
+
+#include <AK/FixedArray.h>
+#include <AK/String.h>
+
+TEST_CASE(construct)
+{
+ EXPECT(FixedArray<int>().size() == 0);
+}
+
+TEST_CASE(ints)
+{
+ FixedArray<int> ints(3);
+ ints[0] = 0;
+ ints[1] = 1;
+ ints[2] = 2;
+ EXPECT_EQ(ints[0], 0);
+ EXPECT_EQ(ints[1], 1);
+ EXPECT_EQ(ints[2], 2);
+
+ ints.clear();
+ EXPECT_EQ(ints.size(), 0u);
+}