Modify Tests

This commit is contained in:
MattBDev 2020-03-27 19:09:26 -04:00
parent 9c3fea6567
commit 6275e9298e
3 changed files with 96 additions and 6 deletions

View File

@ -23,14 +23,15 @@ import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import java.util.HashSet;
import java.util.Set;
import org.junit.jupiter.api.BeforeEach;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.HashSet;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertEquals;
@Disabled("A platform is currently required to get properties, preventing this test.")
public class BlockTransformExtentTest {

View File

@ -19,11 +19,13 @@
package com.sk89q.worldedit.util;
import static org.junit.jupiter.api.Assertions.assertEquals;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.world.World;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
/**
@ -134,4 +136,22 @@ public class LocationTest {
assertEquals(TEST_VALUE, location2.getZ(), EPSILON);
}
@RepeatedTest(value = 5)
public void testAddInt() throws Exception {
World world = mock(World.class);
long start = System.currentTimeMillis();
BlockVector3 location1 = BlockVector3.ZERO;
BlockVector3.at(location1.getX() + 10, location1.getY() + 10, location1.getZ() + 10);
System.out.println(System.currentTimeMillis() - start + " ms");
}
@RepeatedTest(value = 5)
public void testAddObj() throws Exception {
World world = mock(World.class);
long start = System.currentTimeMillis();
BlockVector3 location1 = BlockVector3.ZERO;
location1.add(10,10,10);
System.out.println(System.currentTimeMillis() - start + " ms");
}
}

View File

@ -0,0 +1,69 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.util.io.file;
import org.junit.jupiter.api.Test;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Stream;
import static java.util.stream.Collectors.toList;
import static org.junit.jupiter.api.Assertions.assertEquals;
class MorePathsTest {
private static List<Path> paths(String... paths) {
return Stream.of(paths).map(Paths::get).collect(toList());
}
@Test
void testRelative() {
assertEquals(
paths("a", "a/b", "a/b/c"),
MorePaths.iterPaths(Paths.get("a/b/c")).collect(toList())
);
}
@Test
void testAbsolute() {
assertEquals(
paths("/", "/a", "/a/b", "/a/b/c"),
MorePaths.iterPaths(Paths.get("/a/b/c")).collect(toList())
);
}
@Test
void testEmpty() {
assertEquals(
paths(""),
MorePaths.iterPaths(Paths.get("")).collect(toList())
);
}
@Test
void testJustFile() {
assertEquals(
paths("a"),
MorePaths.iterPaths(Paths.get("a")).collect(toList())
);
}
}