LuaVoxelManip: Add option to allocate blank data
[oweals/minetest.git] / src / test.cpp
index 63d8219a9ab7ff68e1e55629a00fc30fbfe243ab..c30af0d1fbe5f6c730ca9267b38712439846c84c 100644 (file)
@@ -273,8 +273,8 @@ struct TestPath: public TestBase
                                expected fs::PathStartsWith results
                                0 = returns false
                                1 = returns true
-                               2 = returns false on windows, false elsewhere
-                               3 = returns true on windows, true elsewhere
+                               2 = returns false on windows, true elsewhere
+                               3 = returns true on windows, false elsewhere
                                4 = returns true if and only if
                                    FILESYS_CASE_INSENSITIVE is true
                        */
@@ -440,7 +440,7 @@ struct TestPath: public TestBase
        "some multiline text\n"                   \
        "     with leading whitespace!\n"         \
        "\"\"\"\n"                                \
-       "np_terrain = 5, 40, (250, 250, 250), 12345, 5, 0.7\n" \
+       "np_terrain = 5, 40, (250, 250, 250), 12341, 5, 0.7, 2.4\n" \
        "zoop = true"
 
 #define TEST_CONFIG_TEXT_AFTER                \
@@ -467,12 +467,12 @@ struct TestPath: public TestBase
        "\"\"\"\n"                                \
        "np_terrain = {\n"                        \
        "       flags = defaults\n"                   \
-       "       lacunarity = 2\n"                     \
+       "       lacunarity = 2.4\n"                   \
        "       octaves = 6\n"                        \
        "       offset = 3.5\n"                       \
        "       persistence = 0.7\n"                  \
        "       scale = 40\n"                         \
-       "       seed = 12345\n"                       \
+       "       seed = 12341\n"                       \
        "       spread = (250,250,250)\n"             \
        "}\n"                                     \
        "zoop = true\n"                           \
@@ -533,6 +533,11 @@ struct TestSettings: public TestBase
                group2->set("animals", "cute"); //destroys group 3
                s.setGroup("groupy_thing", group2);
 
+               // Test set failure conditions
+               UASSERT(s.set("Zoop = Poop\nsome_other_setting", "false") == false);
+               UASSERT(s.set("sneaky", "\"\"\"\njabberwocky = false") == false);
+               UASSERT(s.set("hehe", "asdfasdf\n\"\"\"\nsomething = false") == false);
+
                // Test multiline settings
                UASSERT(group->get("ccc") == "testy\n   testa   ");
 
@@ -550,7 +555,7 @@ struct TestSettings: public TestBase
                UASSERT(fabs(np.spread.X - 250) < 0.001);
                UASSERT(fabs(np.spread.Y - 250) < 0.001);
                UASSERT(fabs(np.spread.Z - 250) < 0.001);
-               UASSERT(np.seed == 12345);
+               UASSERT(np.seed == 12341);
                UASSERT(np.octaves == 5);
                UASSERT(fabs(np.persist - 0.7) < 0.001);
 
@@ -2172,6 +2177,8 @@ void run_tests()
        IWritableNodeDefManager *ndef = createNodeDefManager();
        define_some_nodes(idef, ndef);
 
+       log_set_lev_silence(LMT_ERROR, true);
+
        infostream<<"run_tests() started"<<std::endl;
        TEST(TestUtilities);
        TEST(TestPath);
@@ -2193,6 +2200,8 @@ void run_tests()
                dout_con<<"=== END RUNNING UNIT TESTS FOR CONNECTION ==="<<std::endl;
        }
 
+       log_set_lev_silence(LMT_ERROR, false);
+
        delete idef;
        delete ndef;