Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Giorgi committed Nov 6, 2024
1 parent 39e2797 commit dae2a76
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions DuckDB.NET.Test/Parameters/IntegerParametersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public void Int64Test(long value)
}

[Theory]
[Trait("Category", "Long Running")]
[MemberData(nameof(GetBigIntegers))]
public void VarintTest(BigInteger expectedValue)
{
Expand Down
31 changes: 31 additions & 0 deletions DuckDB.NET.Test/TableFunctionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,35 @@ public void RegisterTableFunctionWithFourParameters()
var bytes = guid.ToByteArray(false).Append((byte)4);
data.Should().BeEquivalentTo(bytes);
}

[Fact]
public void RegisterTableFunctionWithEmptyResult()
{
Connection.RegisterTableFunction<sbyte, ushort, uint, ulong, float>("demo5", (parameters) =>
{
var param1 = parameters[0].GetValue<sbyte>();
var param2 = parameters[1].GetValue<ushort>();
var param3 = parameters[2].GetValue<uint>();
var param4 = parameters[3].GetValue<ulong>();
var param5 = parameters[4].GetValue<float>();
param1.Should().Be(1);
param2.Should().Be(2);
param3.Should().Be(3);
param4.Should().Be(4);
param5.Should().Be(5.6f);
return new TableFunction(new List<ColumnInfo>()
{
new ColumnInfo("foo", typeof(int)),
}, Enumerable.Empty<int>());
}, (item, writers, rowIndex) =>
{
writers[0].WriteValue((int)item, rowIndex);
});

var data = Connection.Query<int>($"SELECT * FROM demo5(1::TINYINT, 2::USMALLINT, 3::UINTEGER, 4::UBIGINT, 5.6);").ToList();

data.Should().BeEquivalentTo(Enumerable.Empty<int>());
}
}

0 comments on commit dae2a76

Please sign in to comment.