-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4163907
commit c237644
Showing
11 changed files
with
278 additions
and
29 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
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,51 @@ | ||
using FlatSharp.Internal; | ||
using System.Linq.Expressions; | ||
|
||
namespace FlatSharpStrykerTests; | ||
|
||
public class ScalarFieldTests | ||
{ | ||
[Theory] | ||
[ClassData(typeof(DeserializationOptionClassData))] | ||
public void ValueStructTableField(FlatBufferDeserializationOption option) | ||
{ | ||
Root r = CreateTableWithScalarField(out byte[] buffer); | ||
Root parsed = r.SerializeAndParse(option, out byte[] actual); | ||
|
||
Assert.Equal(r.Fields.Memory, parsed.Fields.Memory); | ||
Helpers.AssertSequenceEqual(buffer, actual); | ||
} | ||
|
||
private static Root CreateTableWithScalarField(out byte[] expectedBuffer) | ||
{ | ||
Root root = new Root | ||
{ | ||
Fields = new() | ||
{ | ||
Memory = 3, | ||
} | ||
}; | ||
|
||
expectedBuffer = new byte[] | ||
{ | ||
4, 0, 0, 0, // offset to table start | ||
248, 255, 255, 255, // soffset to vtable. | ||
12, 0, 0, 0, // uoffset to field 0 (fields table) | ||
6, 0, // vtable length | ||
8, 0, // table length | ||
4, 0, // offset of field 0 | ||
0, 0, // padding | ||
|
||
250, 255, 255, 255, // soffset to vtable | ||
3, 0, | ||
|
||
10, 0, | ||
5, 0, | ||
0, 0, | ||
0, 0, | ||
4, 0, | ||
}; | ||
|
||
return root; | ||
} | ||
} |
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.