Skip to content

Commit dae2a76

Browse files
committed
Add test
1 parent 39e2797 commit dae2a76

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

DuckDB.NET.Test/Parameters/IntegerParametersTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ public void Int64Test(long value)
166166
}
167167

168168
[Theory]
169+
[Trait("Category", "Long Running")]
169170
[MemberData(nameof(GetBigIntegers))]
170171
public void VarintTest(BigInteger expectedValue)
171172
{

DuckDB.NET.Test/TableFunctionTests.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,35 @@ public void RegisterTableFunctionWithFourParameters()
117117
var bytes = guid.ToByteArray(false).Append((byte)4);
118118
data.Should().BeEquivalentTo(bytes);
119119
}
120+
121+
[Fact]
122+
public void RegisterTableFunctionWithEmptyResult()
123+
{
124+
Connection.RegisterTableFunction<sbyte, ushort, uint, ulong, float>("demo5", (parameters) =>
125+
{
126+
var param1 = parameters[0].GetValue<sbyte>();
127+
var param2 = parameters[1].GetValue<ushort>();
128+
var param3 = parameters[2].GetValue<uint>();
129+
var param4 = parameters[3].GetValue<ulong>();
130+
var param5 = parameters[4].GetValue<float>();
131+
132+
param1.Should().Be(1);
133+
param2.Should().Be(2);
134+
param3.Should().Be(3);
135+
param4.Should().Be(4);
136+
param5.Should().Be(5.6f);
137+
138+
return new TableFunction(new List<ColumnInfo>()
139+
{
140+
new ColumnInfo("foo", typeof(int)),
141+
}, Enumerable.Empty<int>());
142+
}, (item, writers, rowIndex) =>
143+
{
144+
writers[0].WriteValue((int)item, rowIndex);
145+
});
146+
147+
var data = Connection.Query<int>($"SELECT * FROM demo5(1::TINYINT, 2::USMALLINT, 3::UINTEGER, 4::UBIGINT, 5.6);").ToList();
148+
149+
data.Should().BeEquivalentTo(Enumerable.Empty<int>());
150+
}
120151
}

0 commit comments

Comments
 (0)