1 module doml.tests.vector_2i_test; 2 3 import std.stdio; 4 import doml.tests.dunit_tests; 5 import doml.vector_2i; 6 import doml.vector_2d; 7 import doml.rounding_mode; 8 9 /* 10 * The MIT License 11 * 12 * Copyright (c) 2015-2021 JOML. 13 ^%$^%$^ Translated by jordan4ibanez 14 * 15 * Permission is hereby granted, free of charge, to any person obtaining a copy 16 * of this software and associated documentation files (the "Software"), to deal 17 * in the Software without restriction, including without limitation the rights 18 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 * copies of the Software, and to permit persons to whom the Software is 20 * furnished to do so, subject to the following conditions: 21 * 22 * The above copyright notice and this permission notice shall be included in 23 * all copies or substantial portions of the Software. 24 * 25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 * THE SOFTWARE. 32 */ 33 34 /** 35 * Test class for {@link Vector2i}. 36 */ 37 unittest { 38 39 writeln("\nBEGINNING GENERAL VECTOR2I TEST\n"); 40 41 Vector2i v1 = Vector2i(0.0,.6, RoundingMode.FLOOR); 42 Vector2i v2 = Vector2i(9.5,1.6, RoundingMode.FLOOR); 43 44 Vector2i v3 = Vector2i(Vector2d(0.0,.6), RoundingMode.FLOOR); 45 Vector2i v4 = Vector2i(Vector2d(9.5,1.6), RoundingMode.FLOOR); 46 47 Vector2i v5 = Vector2i(0.0,.6, RoundingMode.CEILING); 48 Vector2i v6 = Vector2i(9.5,1.6, RoundingMode.CEILING); 49 50 Vector2i v7 = Vector2i(Vector2d(0.0,.6), RoundingMode.CEILING); 51 Vector2i v8 = Vector2i(Vector2d(9.5,1.6), RoundingMode.CEILING); 52 53 assertEquals(v1, Vector2i(0,0)); 54 assertEquals(v2, Vector2i(9,1)); 55 56 assertEquals(v3, Vector2i(0,0)); 57 assertEquals(v4, Vector2i(9,1)); 58 59 assertEquals(v5, Vector2i(0,1)); 60 assertEquals(v6, Vector2i(10,2)); 61 62 assertEquals(v7, Vector2i(0,1)); 63 assertEquals(v8, Vector2i(10,2)); 64 65 writeln("PASSED!"); 66 }