From 787d7f531e39066df68ee498d57e2a1447970d4f Mon Sep 17 00:00:00 2001 From: gravestench Date: Wed, 31 Mar 2021 00:28:01 -0700 Subject: [PATCH] add layer schema test --- d2common/d2fileformats/d2ds1/ds1_test.go | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/d2common/d2fileformats/d2ds1/ds1_test.go b/d2common/d2fileformats/d2ds1/ds1_test.go index cb89e817..2ba80a0a 100644 --- a/d2common/d2fileformats/d2ds1/ds1_test.go +++ b/d2common/d2fileformats/d2ds1/ds1_test.go @@ -220,3 +220,28 @@ func TestDS1_SetSize(t *testing.T) { t.Fatal("unexpected width/height after setting size") } } + +func Test_getLayerSchema(t *testing.T) { + ds1 := exampleData() + + expected := map[int]layerStreamType{ + 0: layerStreamWall1, + 1: layerStreamOrientation1, + 2: layerStreamWall2, + 3: layerStreamOrientation2, + 4: layerStreamFloor1, + 5: layerStreamShadow1, + } + + schema := ds1.getLayerSchema() + + if len(schema) != len(expected) { + t.Fatal("unexpected schema length") + } + + for idx := range expected { + if schema[idx] != expected[idx] { + t.Fatal("unexpected layer type in schema") + } + } +}