From 29b5cd9a50ef4174003d7fe0392603d97219036d Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 20 Mar 2023 19:50:18 -0500 Subject: [PATCH] Move SectionPos tests into their own file --- .../src/test/java/tests/DhSectionPosTest.java | 56 +++++++++++++++++++ core/src/test/java/tests/QuadTreeTest.java | 18 +----- 2 files changed, 57 insertions(+), 17 deletions(-) create mode 100644 core/src/test/java/tests/DhSectionPosTest.java diff --git a/core/src/test/java/tests/DhSectionPosTest.java b/core/src/test/java/tests/DhSectionPosTest.java new file mode 100644 index 000000000..755abe118 --- /dev/null +++ b/core/src/test/java/tests/DhSectionPosTest.java @@ -0,0 +1,56 @@ +/* + * This file is part of the Distant Horizons mod (formerly the LOD Mod), + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2022 James Seibel + * + * 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, version 3. + * + * 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, see . + */ + +package tests; + +import com.seibel.lod.core.logging.DhLoggerBuilder; +import com.seibel.lod.core.pos.DhBlockPos2D; +import com.seibel.lod.core.pos.DhSectionPos; +import com.seibel.lod.core.util.BitShiftUtil; +import com.seibel.lod.core.util.LodUtil; +import com.seibel.lod.core.util.objects.quadTree.QuadTree; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.core.config.Configurator; +import org.junit.Assert; +import org.junit.Test; + +import java.util.concurrent.atomic.AtomicInteger; + +public class DhSectionPosTest +{ + @Test + public void SectionPosTest() + { + DhSectionPos root = new DhSectionPos((byte)10, 0, 0); + DhSectionPos child = new DhSectionPos((byte)9, 1, 1); + + Assert.assertTrue("section pos contains fail", root.contains(child)); + Assert.assertFalse("section pos contains fail", child.contains(root)); + + + root = new DhSectionPos((byte)10, 1, 0); + child = new DhSectionPos((byte)9, 1, 1); + Assert.assertFalse("section pos contains fail", root.contains(child)); + child = new DhSectionPos((byte)9, 2, 2); + Assert.assertTrue("section pos contains fail", root.contains(child)); + + } + +} diff --git a/core/src/test/java/tests/QuadTreeTest.java b/core/src/test/java/tests/QuadTreeTest.java index 92b00cd24..b2a17d5fc 100644 --- a/core/src/test/java/tests/QuadTreeTest.java +++ b/core/src/test/java/tests/QuadTreeTest.java @@ -51,23 +51,7 @@ public class QuadTreeTest Configurator.setRootLevel(Level.ALL); } - @Test - public void SectionPosTest() - { - DhSectionPos root = new DhSectionPos((byte)10, 0, 0); - DhSectionPos child = new DhSectionPos((byte)9, 1, 1); - - Assert.assertTrue("section pos contains fail", root.contains(child)); - Assert.assertFalse("section pos contains fail", child.contains(root)); - - - root = new DhSectionPos((byte)10, 1, 0); - child = new DhSectionPos((byte)9, 1, 1); - Assert.assertFalse("section pos contains fail", root.contains(child)); - child = new DhSectionPos((byte)9, 2, 2); - Assert.assertTrue("section pos contains fail", root.contains(child)); - - } + @Test public void BasicPositiveQuadTreeTest()