Move Wasmtime for .NET to the Wasmtime repo.
This moves the Wasmtime for .NET implementation to the Wasmtime repo. Wasmtime for .NET is a binding of the Wasmtime API for use in .NET.
This commit is contained in:
64
crates/misc/dotnet/tests/TableExportsTests.cs
Normal file
64
crates/misc/dotnet/tests/TableExportsTests.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace Wasmtime.Tests
|
||||
{
|
||||
public class TableExportsFixture : ModuleFixture
|
||||
{
|
||||
protected override string ModuleFileName => "TableExports.wasm";
|
||||
}
|
||||
|
||||
public class TableExportsTests : IClassFixture<TableExportsFixture>
|
||||
{
|
||||
public TableExportsTests(TableExportsFixture fixture)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
private TableExportsFixture Fixture { get; set; }
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(GetTableExports))]
|
||||
public void ItHasTheExpectedTableExports(string exportName, ValueKind expectedKind, uint expectedMinimum, uint expectedMaximum)
|
||||
{
|
||||
var export = Fixture.Module.Exports.Tables.Where(f => f.Name == exportName).FirstOrDefault();
|
||||
export.Should().NotBeNull();
|
||||
export.Kind.Should().Be(expectedKind);
|
||||
export.Minimum.Should().Be(expectedMinimum);
|
||||
export.Maximum.Should().Be(expectedMaximum);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ItHasTheExpectedNumberOfExportedTables()
|
||||
{
|
||||
GetTableExports().Count().Should().Be(Fixture.Module.Exports.Tables.Count);
|
||||
}
|
||||
|
||||
public static IEnumerable<object[]> GetTableExports()
|
||||
{
|
||||
yield return new object[] {
|
||||
"table1",
|
||||
ValueKind.FuncRef,
|
||||
1,
|
||||
10
|
||||
};
|
||||
|
||||
yield return new object[] {
|
||||
"table2",
|
||||
ValueKind.AnyRef,
|
||||
10,
|
||||
uint.MaxValue
|
||||
};
|
||||
|
||||
yield return new object[] {
|
||||
"table3",
|
||||
ValueKind.FuncRef,
|
||||
100,
|
||||
1000
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user