aboutsummaryrefslogtreecommitdiff
path: root/assets/blender/gleis/rail_redo_bk_curves.blend
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-05-31 15:55:45 +0200
committerorwell96 <mono96.mml@gmail.com>2017-05-31 15:55:45 +0200
commit93250ca3a2a6fd5bf8704b2f8075be874fd815c2 (patch)
tree54d5c393db5a9fadf8974ba3e7f44a27840fd24c /assets/blender/gleis/rail_redo_bk_curves.blend
parentca6989b560cf99af606bbeead1f6551e4f5f3349 (diff)
downloadadvtrains-93250ca3a2a6fd5bf8704b2f8075be874fd815c2.tar.gz
advtrains-93250ca3a2a6fd5bf8704b2f8075be874fd815c2.tar.bz2
advtrains-93250ca3a2a6fd5bf8704b2f8075be874fd815c2.zip
Fix still broken ndb restoring, and make sid() honor nil values
Diffstat (limited to 'assets/blender/gleis/rail_redo_bk_curves.blend')
0 files changed, 0 insertions, 0 deletions
2' href='#n152'>152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "test.h"

#include <cmath>
#include "settings.h"
#include "noise.h"

class TestSettings : public TestBase {
public:
	TestSettings() { TestManager::registerTestModule(this); }
	const char *getName() { return "TestSettings"; }

	void runTests(IGameDef *gamedef);

	void testAllSettings();

	static const char *config_text_before;
	static const std::string config_text_after;
};

static TestSettings g_test_instance;

void TestSettings::runTests(IGameDef *gamedef)
{
	TEST(testAllSettings);
}

////////////////////////////////////////////////////////////////////////////////

const char *TestSettings::config_text_before =
	"leet = 1337\n"
	"leetleet = 13371337\n"
	"leetleet_neg = -13371337\n"
	"floaty_thing = 1.1\n"
	"stringy_thing = asd /( ¤%&(/\" BLÖÄRP\n"
	"coord = (1, 2, 4.5)\n"
	"      # this is just a comment\n"
	"this is an invalid line\n"
	"asdf = {\n"
	"	a   = 5\n"
	"	bb  = 2.5\n"
	"	ccc = \"\"\"\n"
	"testy\n"
	"   testa   \n"
	"\"\"\"\n"
	"\n"
	"}\n"
	"blarg = \"\"\" \n"
	"some multiline text\n"
	"     with leading whitespace!\n"
	"\"\"\"\n"
	"np_terrain = 5, 40, (250, 250, 250), 12341, 5, 0.7, 2.4\n"
	"zoop = true";

const std::string TestSettings::config_text_after =
	"leet = 1337\n"
	"leetleet = 13371337\n"
	"leetleet_neg = -13371337\n"
	"floaty_thing = 1.1\n"
	"stringy_thing = asd /( ¤%&(/\" BLÖÄRP\n"
	"coord = (1, 2, 4.5)\n"
	"      # this is just a comment\n"
	"this is an invalid line\n"
	"asdf = {\n"
	"	a   = 5\n"
	"	bb  = 2.5\n"
	"	ccc = \"\"\"\n"
	"testy\n"
	"   testa   \n"
	"\"\"\"\n"
	"\n"
	"}\n"
	"blarg = \"\"\" \n"
	"some multiline text\n"
	"     with leading whitespace!\n"
	"\"\"\"\n"
	"np_terrain = {\n"
	"	flags = defaults\n"
	"	lacunarity = 2.4\n"
	"	octaves = 6\n"
	"	offset = 3.5\n"
	"	persistence = 0.7\n"
	"	scale = 40\n"
	"	seed = 12341\n"
	"	spread = (250,250,250)\n"
	"}\n"
	"zoop = true\n"
	"coord2 = (1,2,3.3)\n"
	"floaty_thing_2 = 1.2\n"
	"groupy_thing = {\n"
	"	animals = cute\n"
	"	num_apples = 4\n"
	"	num_oranges = 53\n"
	"}\n";

void TestSettings::testAllSettings()
{
	try {
	Settings s;

	// Test reading of settings
	std::istringstream is(config_text_before);
	s.parseConfigLines(is);

	UASSERT(s.getS32("leet") == 1337);
	UASSERT(s.getS16("leetleet") == 32767);
	UASSERT(s.getS16("leetleet_neg") == -32768);

	// Not sure if 1.1 is an exact value as a float, but doesn't matter
	UASSERT(fabs(s.getFloat("floaty_thing") - 1.1) < 0.001);
	UASSERT(s.get("stringy_thing") == "asd /( ¤%&(/\" BLÖÄRP");
	UASSERT(fabs(s.getV3F("coord").X - 1.0) < 0.001);
	UASSERT(fabs(s.getV3F("coord").Y - 2.0) < 0.001);
	UASSERT(fabs(s.getV3F("coord").Z - 4.5) < 0.001);

	// Test the setting of settings too
	s.setFloat("floaty_thing_2", 1.2);
	s.setV3F("coord2", v3f(1, 2, 3.3));
	UASSERT(s.get("floaty_thing_2").substr(0,3) == "1.2");
	UASSERT(fabs(s.getFloat("floaty_thing_2") - 1.2) < 0.001);
	UASSERT(fabs(s.getV3F("coord2").X - 1.0) < 0.001);
	UASSERT(fabs(s.getV3F("coord2").Y - 2.0) < 0.001);
	UASSERT(fabs(s.getV3F("coord2").Z - 3.3) < 0.001);