Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
Modify Tests
Dieser Commit ist enthalten in:
Ursprung
9c3fea6567
Commit
6275e9298e
@ -23,14 +23,15 @@ import com.sk89q.worldedit.math.transform.AffineTransform;
|
|||||||
import com.sk89q.worldedit.math.transform.Transform;
|
import com.sk89q.worldedit.math.transform.Transform;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
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.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
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.")
|
@Disabled("A platform is currently required to get properties, preventing this test.")
|
||||||
public class BlockTransformExtentTest {
|
public class BlockTransformExtentTest {
|
||||||
|
|
||||||
|
@ -19,11 +19,13 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.util;
|
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.math.Vector3;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
import org.junit.jupiter.api.RepeatedTest;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,4 +136,22 @@ public class LocationTest {
|
|||||||
assertEquals(TEST_VALUE, location2.getZ(), EPSILON);
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren