summaryrefslogtreecommitdiff
path: root/AK/Tests/TestQueue.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-07-16 10:08:39 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-16 11:03:38 +0200
commit41d2c674d764314c2930bcf4bfcf2992bf6b5cb8 (patch)
treec26da13d12db7942425192dbee354993cc4c27b9 /AK/Tests/TestQueue.cpp
parentdf3e295ba6ee69f0b178c581f1d91f8c322c0c4d (diff)
downloadserenity-41d2c674d764314c2930bcf4bfcf2992bf6b5cb8.zip
AK: Add a new TestSuite.h from my own work, adapted to match the existing one a bit
This gives a few new features: * benchmarks * the ability to run individual testcases easily * timing of tests
Diffstat (limited to 'AK/Tests/TestQueue.cpp')
-rw-r--r--AK/Tests/TestQueue.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/AK/Tests/TestQueue.cpp b/AK/Tests/TestQueue.cpp
index a604074215..23d30f5de2 100644
--- a/AK/Tests/TestQueue.cpp
+++ b/AK/Tests/TestQueue.cpp
@@ -1,12 +1,15 @@
-#include "TestHelpers.h"
+#include <AK/TestSuite.h>
#include <AK/AKString.h>
#include <AK/Queue.h>
-int main()
+TEST_CASE(construct)
{
EXPECT(Queue<int>().is_empty());
EXPECT(Queue<int>().size() == 0);
+}
+TEST_CASE(populate_int)
+{
Queue<int> ints;
ints.enqueue(1);
ints.enqueue(2);
@@ -18,7 +21,10 @@ int main()
EXPECT_EQ(ints.size(), 1);
EXPECT_EQ(ints.dequeue(), 3);
EXPECT_EQ(ints.size(), 0);
+}
+TEST_CASE(populate_string)
+{
Queue<String> strings;
strings.enqueue("ABC");
strings.enqueue("DEF");
@@ -26,6 +32,12 @@ int main()
EXPECT_EQ(strings.dequeue(), "ABC");
EXPECT_EQ(strings.dequeue(), "DEF");
EXPECT(strings.is_empty());
+}
+
+TEST_CASE(order)
+{
+ Queue<String> strings;
+ EXPECT(strings.is_empty());
for (int i = 0; i < 10000; ++i) {
strings.enqueue(String::number(i));
@@ -38,6 +50,6 @@ int main()
}
EXPECT(strings.is_empty());
-
- return 0;
}
+
+TEST_MAIN(Queue)