mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-26 23:50:23 +07:00
Improved test cases for MonPreset table
This commit is contained in:
parent
cb31a45ed4
commit
ad3de24792
@ -6,6 +6,8 @@ import javax.annotation.Generated;
|
||||
import com.badlogic.gdx.utils.IntArray;
|
||||
|
||||
import com.riiablo.Riiablo;
|
||||
import com.riiablo.logger.LogManager;
|
||||
import com.riiablo.logger.Logger;
|
||||
import com.riiablo.table.Parser;
|
||||
import com.riiablo.table.ParserInput;
|
||||
import com.riiablo.table.Serializer;
|
||||
@ -20,6 +22,8 @@ import com.riiablo.table.serializer.MonPresetSerializer;
|
||||
comments = "com.riiablo.table.schema.MonPreset"
|
||||
)
|
||||
public final class MonPresetTable extends Table<MonPreset> {
|
||||
private static final Logger log = LogManager.getLogger(MonPresetTable.class);
|
||||
|
||||
public MonPresetTable() {
|
||||
super(MonPreset.class, 53, 0.8f);
|
||||
}
|
||||
@ -72,7 +76,9 @@ public final class MonPresetTable extends Table<MonPreset> {
|
||||
@Override
|
||||
protected void put(int id, MonPreset record) {
|
||||
super.put(id, record);
|
||||
lookup[record.Act].add(id);
|
||||
final IntArray lookup = this.lookup[record.Act];
|
||||
lookup.add(id);
|
||||
log.trace("lookup[{}][{}] = {} ({})", record.Act, lookup.size - 1, record, id);
|
||||
}
|
||||
|
||||
public MonPreset get(int act, int id) {
|
||||
|
@ -213,8 +213,23 @@ public class TablesTest extends RiiabloTest {
|
||||
TableManifest.monpreset.parser = null;
|
||||
FileHandle handle = Gdx.files.internal("test/monpreset.txt");
|
||||
MonPresetTable table = Tables.loadTsv(TableManifest.monpreset, handle);
|
||||
for (int i = 0, s = table.parser.parser().numRecords(); i < s; i++) {
|
||||
System.out.println(table.get(i));
|
||||
}
|
||||
for (int i = 0, s = table.parser.parser().numRecords(); i < s; i++) table.get(i);
|
||||
Assert.assertEquals(47, table.getSize(1));
|
||||
Assert.assertEquals("gheed", table.getPlace(1, 0));
|
||||
Assert.assertEquals("cain1", table.getPlace(1, 1));
|
||||
Assert.assertEquals("The Cow King", table.getPlace(1, 45));
|
||||
Assert.assertEquals("Corpsefire", table.getPlace(1, 46));
|
||||
Assert.assertEquals(59, table.getSize(2));
|
||||
Assert.assertEquals("warriv2", table.getPlace(2, 0));
|
||||
Assert.assertEquals("skeleton5", table.getPlace(2, 58));
|
||||
Assert.assertEquals(39, table.getSize(3));
|
||||
Assert.assertEquals("cain3", table.getPlace(3, 0));
|
||||
Assert.assertEquals("Maffer Dragonhand", table.getPlace(3, 38));
|
||||
Assert.assertEquals(28, table.getSize(4));
|
||||
Assert.assertEquals("place_champion", table.getPlace(4, 0));
|
||||
Assert.assertEquals("The Feature Creep", table.getPlace(4, 27));
|
||||
Assert.assertEquals(56, table.getSize(5));
|
||||
Assert.assertEquals("larzuk", table.getPlace(5, 0));
|
||||
Assert.assertEquals("place_nothing", table.getPlace(5, 55));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user