/** * Test if two serializers are equal, by creating a tile data, and making sure each reads the * output of the other. */ public static <T> void assertSerializersEqual (TileSerializer<T> expected, TileSerializer<T> actual, DataSource<T> random) throws Exception { int nX = 8; int nY = 8; TileIndex index = new TileIndex(4, 3, 2, nX, nY); TileData<T> data = new DenseTileData<>(index); for (int x=0; x<nX; ++x) { for (int y=0; y<nY; ++y) { data.setBin(x, y, random.create()); } } assertTilesEqual(data, roundTrip(data, expected, actual)); assertTilesEqual(data, roundTrip(data, actual, expected)); }