Skip to content

Commit

Permalink
Create an empty Ctd
Browse files Browse the repository at this point in the history
  • Loading branch information
Xeeynamo committed Feb 28, 2020
1 parent 7d49490 commit 56fb194
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions OpenKh.Bbs/Ctd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ public void Write(Stream stream)
}
}

public Ctd()
{
Unknown = 0;
Entries1 = new List<FakeEntry>();
Entries2 = new List<Entry2>();
}

private Ctd(Stream stream)
{
var header = BinaryMapping.ReadObject<Header>(stream);
Expand Down
11 changes: 11 additions & 0 deletions OpenKh.Tests/Bbs/CtdTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,16 @@ public void WritesBackCorrectly() => FileOpenRead(FileName, stream =>
return outStream;
}));

[Fact]
public void CreateEmptyCtdWithoutNullValues()
{
var ctd = new Ctd();
Assert.NotNull(ctd.Entries1);
Assert.NotNull(ctd.Entries2);
Assert.Empty(ctd.Entries1);
Assert.Empty(ctd.Entries2);
Assert.Equal(0, ctd.Unknown);
}
}
}

0 comments on commit 56fb194

Please sign in to comment.