mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-15 21:43:53 +00:00
Adjusted some of the cycler code and added a test case for it.
- Added range checks for most blocks - torches: Fixed cycle from 0->1->2->3->0 to 1->2->3->4->1 - mushroom caps: Included data value 10 (stem) in cycle - vines: Included data value 0 (top attachment only) in the cycle - furnaces/dispensers: Linearised the cycle. It's now 2->3->4->5->2 - chests/ladders: Added cycle code. - rails: Linearised the cycle. It's now 6->7->8->9->6
This commit is contained in:
@ -22,12 +22,13 @@ package com.sk89q.worldedit.data;
|
||||
import org.junit.*;
|
||||
|
||||
import com.sk89q.worldedit.CuboidClipboard.FlipDirection;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class BlockDataTest {
|
||||
@Test
|
||||
public void testSlice() {
|
||||
public void testRotateFlip() {
|
||||
for (int type = 0; type < 256; ++type) {
|
||||
for (int data = 0; data < 16; ++data) {
|
||||
final String message = type+"/"+data;
|
||||
@ -46,4 +47,24 @@ public class BlockDataTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCycle() {
|
||||
for (int type = 0; type < 256; ++type) {
|
||||
if (type == BlockID.CLOTH)
|
||||
continue;
|
||||
|
||||
for (int data = 0; data < 16; ++data) {
|
||||
final String message = type+"/"+data;
|
||||
|
||||
int cycled = BlockData.cycle(type, data, 1);
|
||||
|
||||
if (cycled <= data) {
|
||||
continue;
|
||||
}
|
||||
|
||||
assertEquals(message, data+1, cycled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user