summaryrefslogtreecommitdiffstats
path: root/tests/core/templates
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2021-07-16 00:28:05 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2022-01-05 20:42:09 +0800
commitc0d3bdc0cac39f9a7a1ba5327b694f7b4350faeb (patch)
tree8af7999e0c4e2e6fcc543ab56862a8f667dc302c /tests/core/templates
parentd2ac67d55e693e26b1927ca25b9b1037acb1a256 (diff)
downloadredot-engine-c0d3bdc0cac39f9a7a1ba5327b694f7b4350faeb.tar.gz
Add list initialization support for Vector & LocalVector
Diffstat (limited to 'tests/core/templates')
-rw-r--r--tests/core/templates/test_local_vector.h11
-rw-r--r--tests/core/templates/test_vector.h11
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/core/templates/test_local_vector.h b/tests/core/templates/test_local_vector.h
index ca4a69b069..b2464c3914 100644
--- a/tests/core/templates/test_local_vector.h
+++ b/tests/core/templates/test_local_vector.h
@@ -37,6 +37,17 @@
namespace TestLocalVector {
+TEST_CASE("[LocalVector] List Initialization.") {
+ LocalVector<int> vector{ 0, 1, 2, 3, 4 };
+
+ CHECK(vector.size() == 5);
+ CHECK(vector[0] == 0);
+ CHECK(vector[1] == 1);
+ CHECK(vector[2] == 2);
+ CHECK(vector[3] == 3);
+ CHECK(vector[4] == 4);
+}
+
TEST_CASE("[LocalVector] Push Back.") {
LocalVector<int> vector;
vector.push_back(0);
diff --git a/tests/core/templates/test_vector.h b/tests/core/templates/test_vector.h
index b0dcff93fd..24b3547256 100644
--- a/tests/core/templates/test_vector.h
+++ b/tests/core/templates/test_vector.h
@@ -37,6 +37,17 @@
namespace TestVector {
+TEST_CASE("[Vector] List initialization") {
+ Vector<int> vector{ 0, 1, 2, 3, 4 };
+
+ CHECK(vector.size() == 5);
+ CHECK(vector[0] == 0);
+ CHECK(vector[1] == 1);
+ CHECK(vector[2] == 2);
+ CHECK(vector[3] == 3);
+ CHECK(vector[4] == 4);
+}
+
TEST_CASE("[Vector] Push back and append") {
Vector<int> vector;
vector.push_back(0);