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:
67
crates/misc/dotnet/tests/TableImportsTests.cs
Normal file
67
crates/misc/dotnet/tests/TableImportsTests.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace Wasmtime.Tests
|
||||
{
|
||||
public class TableImportsFixture : ModuleFixture
|
||||
{
|
||||
protected override string ModuleFileName => "TableImports.wasm";
|
||||
}
|
||||
|
||||
public class TableImportsTests : IClassFixture<TableImportsFixture>
|
||||
{
|
||||
public TableImportsTests(TableImportsFixture fixture)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
private TableImportsFixture Fixture { get; set; }
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(GetTableImports))]
|
||||
public void ItHasTheExpectedTableImports(string importModule, string importName, ValueKind expectedKind, uint expectedMinimum, uint expectedMaximum)
|
||||
{
|
||||
var import = Fixture.Module.Imports.Tables.Where(f => f.ModuleName == importModule && f.Name == importName).FirstOrDefault();
|
||||
import.Should().NotBeNull();
|
||||
import.Kind.Should().Be(expectedKind);
|
||||
import.Minimum.Should().Be(expectedMinimum);
|
||||
import.Maximum.Should().Be(expectedMaximum);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ItHasTheExpectedNumberOfExportedTables()
|
||||
{
|
||||
GetTableImports().Count().Should().Be(Fixture.Module.Imports.Tables.Count);
|
||||
}
|
||||
|
||||
public static IEnumerable<object[]> GetTableImports()
|
||||
{
|
||||
yield return new object[] {
|
||||
"",
|
||||
"table1",
|
||||
ValueKind.FuncRef,
|
||||
10,
|
||||
uint.MaxValue
|
||||
};
|
||||
|
||||
yield return new object[] {
|
||||
"",
|
||||
"table2",
|
||||
ValueKind.AnyRef,
|
||||
15,
|
||||
uint.MaxValue
|
||||
};
|
||||
|
||||
yield return new object[] {
|
||||
"other",
|
||||
"table3",
|
||||
ValueKind.FuncRef,
|
||||
1,
|
||||
uint.MaxValue
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user