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:
TomyLobo
2011-09-25 10:14:06 +02:00
parent 93f36955ca
commit c6c55c3b2a
2 changed files with 55 additions and 29 deletions

View File

@ -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);
}
}
}
}