-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed some bugs with parsing booleans.
- Loading branch information
1 parent
966cf3b
commit 16e91ab
Showing
11 changed files
with
519 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
using NUnit.Framework; | ||
|
||
|
||
namespace schema.binary.text { | ||
internal class CharGeneratorTests { | ||
[Test] | ||
public void TestChar() { | ||
BinarySchemaTestUtil.AssertGenerated(@" | ||
using schema.binary; | ||
using schema.binary.attributes; | ||
namespace foo.bar { | ||
[BinarySchema] | ||
public partial class Wrapper { | ||
public char Field { get; set; } | ||
public char ReadonlyField { get; } | ||
} | ||
}", | ||
@"using System; | ||
using System.IO; | ||
namespace foo.bar { | ||
public partial class Wrapper { | ||
public void Read(IEndianBinaryReader er) { | ||
this.Field = er.ReadChar(); | ||
er.AssertChar(this.ReadonlyField); | ||
} | ||
} | ||
} | ||
", | ||
@"using System; | ||
using System.IO; | ||
namespace foo.bar { | ||
public partial class Wrapper { | ||
public void Write(ISubEndianBinaryWriter ew) { | ||
ew.WriteChar(this.Field); | ||
ew.WriteChar(this.ReadonlyField); | ||
} | ||
} | ||
} | ||
"); | ||
} | ||
|
||
|
||
[Test] | ||
public void TestCharArray() { | ||
BinarySchemaTestUtil.AssertGenerated(@" | ||
using schema.binary; | ||
using schema.binary.attributes; | ||
namespace foo.bar { | ||
[BinarySchema] | ||
public partial class Wrapper { | ||
[SequenceLengthSource(4)] | ||
public char[] Field { get; set; } | ||
} | ||
}", | ||
@"using System; | ||
using System.IO; | ||
using schema.util.sequences; | ||
namespace foo.bar { | ||
public partial class Wrapper { | ||
public void Read(IEndianBinaryReader er) { | ||
this.Field = SequencesUtil.CloneAndResizeSequence(this.Field, 4); | ||
er.ReadChars(this.Field); | ||
} | ||
} | ||
} | ||
", | ||
@"using System; | ||
using System.IO; | ||
namespace foo.bar { | ||
public partial class Wrapper { | ||
public void Write(ISubEndianBinaryWriter ew) { | ||
ew.WriteChars(this.Field); | ||
} | ||
} | ||
} | ||
"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.