[colobot] 131/145: Added some more CBot tests after #793
Didier Raboud
odyx at moszumanska.debian.org
Mon Jul 11 12:56:25 UTC 2016
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository colobot.
commit 11d40197eea2f162bfc495a25709edfa4b0c3719
Author: krzys-h <krzys_h at interia.pl>
Date: Mon Jul 4 12:23:48 2016 +0200
Added some more CBot tests after #793
---
test/unit/CBot/CBot_test.cpp | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/test/unit/CBot/CBot_test.cpp b/test/unit/CBot/CBot_test.cpp
index c0d5e12..2d96d59 100644
--- a/test/unit/CBot/CBot_test.cpp
+++ b/test/unit/CBot/CBot_test.cpp
@@ -808,6 +808,33 @@ TEST_F(CBotUT, ClassDestructor)
);
}
+TEST_F(CBotUT, ClassBadNew)
+{
+ ExecuteTest(
+ "public class AClass {};\n"
+ "extern void ClassBadNew()\n"
+ "{\n"
+ " AClass a = new \"abc\";\n"
+ "}\n",
+ CBotErrBadNew
+ );
+}
+
+TEST_F(CBotUT, ClassCallOnNull)
+{
+ ExecuteTest(
+ "public class AClass {\n"
+ " public void test() {}\n"
+ "};\n"
+ "extern void ClassCallOnNull()\n"
+ "{\n"
+ " AClass a = null;\n"
+ " a.test();\n"
+ "}\n",
+ CBotErrNull
+ );
+}
+
TEST_F(CBotUT, ClassNullPointer)
{
ExecuteTest(
@@ -1105,6 +1132,19 @@ TEST_F(CBotUT, TestArrayInitialization)
"}\n",
CBotErrOutArray
);
+
+ ExecuteTest(
+ "extern void TestArrayInitializationWithVars() {\n"
+ " int x=1, y=2, z=3;\n"
+ " int i[] = { x, y, z };\n"
+ " ASSERT(i[0] == 1);\n"
+ " ASSERT(i[1] == 2);\n"
+ " ASSERT(i[2] == 3);\n"
+ " i[0] += 1;\n"
+ " ASSERT(i[0] == 2);\n"
+ " ASSERT(x == 1);\n"
+ "}\n"
+ );
}
TEST_F(CBotUT, TestArrayFunctionReturn)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list