aboutsummaryrefslogtreecommitdiff
path: root/textures/base/pack/server_ping_3.png
blob: c2cab017e10b3b6babfafe953cf663b7066cfa46 (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 10 00 00 00 10 08 06 00 00 00 1f f3 ff .PNG........IHDR................
0020 61 00 00 00 06 62 4b 47 44 00 5b 00 5b 00 5b 2a d0 0c 88 00 00 00 09 70 48 59 73 00 00 0b 13 00 a....bKGD.[.[.[*.......pHYs.....
0040 00 0b 13 01 00 9a 9c 18 00 00 00 07 74 49 4d 45 07 e1 02 02 10 30 27 a7 6f d9 84 00 00 00 82 49 ............tIME.....0'.o......I
0060 44 41 54 38 cb d5 93 bd 09 c3 40 0c 46 9f c2 4d 90 c6 03 68 09 dd 14 5e 32 5e c5 be 01 02 9e c1 DAT8......@.F..M...h...^2^......
0080 4d 56 90 9b 1c a4 f0 8f c2 15 c6 ea 3e 04 7a 0f 09 89 99 d1 52 0f 1a eb 86 03 54 d5 55 d5 6b 4e MV..........>.z.....R.....T.U.kN
00a0 0d 70 0f 19 94 69 f1 32 2d be d7 0f 1b 94 7e 76 00 7d eb f1 0e ce 88 61 83 4a 84 e7 f1 15 fe 25 .p...i.2-.....~v.}.....a.J.....%
00c0 ee 1a 44 89 5b 03 e4 f7 2c 67 79 78 8d 02 60 b9 73 80 64 b9 fb 1a 7c 6a 23 98 67 01 90 cb bf 71 ..D.[...,gyx..`.s.d...|j#.g....q
00e0 05 ad 84 34 d1 59 bf d0 40 00 00 00 00 49 45 4e 44 ae 42 60 82 ...4.Y..@....IEND.B`.
a> 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
/*
Minetest
Copyright (C) 2010-2014 kwolekr, Ryan Kwolek <kwolekr@minetest.net>

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 "exceptions.h"
#include "noise.h"

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

	void runTests(IGameDef *gamedef);

	void testNoise2dPoint();
	void testNoise2dBulk();
	void testNoise3dPoint();
	void testNoise3dBulk();
	void testNoiseInvalidParams();

	static const float expected_2d_results[10 * 10];
	static const float expected_3d_results[10 * 10 * 10];
};

static TestNoise g_test_instance;

void TestNoise::runTests(IGameDef *gamedef)
{
	TEST(testNoise2dPoint);
	TEST(testNoise2dBulk);
	TEST(testNoise3dPoint);
	TEST(testNoise3dBulk);
	TEST(testNoiseInvalidParams);
}

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

void TestNoise::testNoise2dPoint()
{
	NoiseParams np_normal(20, 40, v3f(50, 50, 50), 9,  5, 0.6, 2.0);

	u32 i = 0;
	for (u32 y = 0; y != 10; y++)
	for (u32 x = 0; x != 10; x++, i++) {
		float actual   = NoisePerlin2D(&np_normal, x, y, 1337);
		float expected = expected_2d_results[i];
		UASSERT(fabs(actual - expected) <= 0.00001);
	}
}

void TestNoise::testNoise2dBulk()
{
	NoiseParams np_normal(20, 40, v3f(50, 50, 50), 9,  5, 0.6, 2.0);
	Noise noise_normal_2d(&np_normal, 1337, 10, 10);
	float *noisevals = noise_normal_2d.perlinMap2D(0, 0, NULL);

	for (u32 i = 0; i != 10 * 10; i++) {
		float actual   = noisevals[i];
		float expected = expected_2d_results[i];
		UASSERT(fabs(actual - expected) <= 0.00001);
	}
}

void TestNoise::testNoise3dPoint()
{