forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTableExportsTests.cs
More file actions
64 lines (56 loc) · 1.76 KB
/
TableExportsTests.cs
File metadata and controls
64 lines (56 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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.wat";
}
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
};
}
}
}