public void IsValidTest(byte[] header, int length, bool expected) => new MemoryStream() .Using(stream => { stream.Write(header, 0, header.Length); stream.SetLength(length); Assert.Equal(expected, Tm2.IsValid(stream)); });
//[InlineData(".tests/kh2_data/map/jp")] public void ValidateAllKH2MapRadarImages(string mapFilesDir) { Directory.GetFiles(mapFilesDir, "*.map").ToList().ForEach( file => { File.OpenRead(file).Using( stream => { Bar.Read(stream) // rada may be multiple occurrence like al06.map .Where( entry => true && entry.Name == "rada" && entry.Type == Bar.EntryType.Tim2 ) .ToList() .ForEach( entry => { Assert.True(Tm2.IsValid(entry.Stream), "Should be TM2"); var imageSet = Tm2.Read(entry.Stream); imageSet.ToList().ForEach( texture => { // All radar images are 4-bpp Assert.NotEmpty(texture.GetData()); Assert.Equal(4 * 16, texture.GetClut().Length); } ); } ); } ); } ); }