Skip to content

Commit

Permalink
test: add test case to schema encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
sierzput authored and aloneguid committed Apr 4, 2024
1 parent f508380 commit 2bede5f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Parquet.Test/Schema/SchemaEncoderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@

namespace Parquet.Test.Schema {
public class SchemaEncoderTest {
[Fact]
public void Encode_decimal_38_flba() {
var f38 = new DecimalDataField("d", 38, 18);
[Theory]
[InlineData(38, 18)]
[InlineData(29, 6)]
public void Encode_decimal(int precision, int scale) {
var f38 = new DecimalDataField("d", precision, scale);
Meta.SchemaElement se = SchemaEncoder.Encode(f38);

int i = 0;
Field f = SchemaEncoder.Decode(new List<Meta.SchemaElement> { se }, new ParquetOptions(), ref i, out _)!;
Assert.Equal(typeof(decimal), ((DataField)f).ClrType);
Assert.IsType<DecimalDataField>(f);
Assert.Equal(precision, ((DecimalDataField)f).Precision);
Assert.Equal(scale, ((DecimalDataField)f).Scale);
}

[Fact]
Expand Down

0 comments on commit 2bede5f

Please sign in to comment.