11using System ;
2+ using System . IO ;
23using FluentAssertions ;
34using Xunit ;
45
@@ -16,6 +17,15 @@ public void ItSetsCompilerStrategy()
1617 using var engine = new Engine ( config ) ;
1718 }
1819
20+ [ Fact ]
21+ public void ItFailsSettingNonexistantCompilerStrategy ( )
22+ {
23+ var config = new Config ( ) ;
24+
25+ var act = ( ) => { config . WithCompilerStrategy ( ( CompilerStrategy ) 123 ) ; } ;
26+ act . Should ( ) . Throw < ArgumentOutOfRangeException > ( ) ;
27+ }
28+
1929 [ Fact ]
2030 public void ItSetsProfilingStrategy ( )
2131 {
@@ -26,6 +36,15 @@ public void ItSetsProfilingStrategy()
2636 using var engine = new Engine ( config ) ;
2737 }
2838
39+ [ Fact ]
40+ public void ItFailsSettingNonexistantProfilingStrategy ( )
41+ {
42+ var config = new Config ( ) ;
43+
44+ var act = ( ) => { config . WithProfilingStrategy ( ( ProfilingStrategy ) 123 ) ; } ;
45+ act . Should ( ) . Throw < ArgumentOutOfRangeException > ( ) ;
46+ }
47+
2948 [ Fact ]
3049 public void ItSetsOptimizationLevel ( )
3150 {
@@ -36,6 +55,15 @@ public void ItSetsOptimizationLevel()
3655 using var engine = new Engine ( config ) ;
3756 }
3857
58+ [ Fact ]
59+ public void ItFailsSettingNonexistantOptimizationLevel ( )
60+ {
61+ var config = new Config ( ) ;
62+
63+ var act = ( ) => { config . WithOptimizationLevel ( ( OptimizationLevel ) 123 ) ; } ;
64+ act . Should ( ) . Throw < ArgumentOutOfRangeException > ( ) ;
65+ }
66+
3967 [ Fact ]
4068 public void ItSetsNanCanonicalization ( )
4169 {
@@ -55,5 +83,71 @@ public void ItSetsEpochInterruption()
5583
5684 using var engine = new Engine ( config ) ;
5785 }
86+
87+ [ Fact ]
88+ public void ItSetsDebugInfo ( )
89+ {
90+ var config = new Config ( ) ;
91+
92+ config . WithDebugInfo ( true ) ;
93+
94+ using var engine = new Engine ( config ) ;
95+ }
96+
97+ [ Fact ]
98+ public void ItSetsThreads ( )
99+ {
100+ var config = new Config ( ) ;
101+ config . WithWasmThreads ( true ) ;
102+
103+ using var engine = new Engine ( config ) ;
104+ using var module = Module . FromTextFile ( engine , Path . Combine ( "Modules" , "SharedMemory.wat" ) ) ;
105+ }
106+
107+ [ Fact ]
108+ public void ItSetsSIMD ( )
109+ {
110+ var config = new Config ( ) ;
111+ config . WithSIMD ( false ) ;
112+
113+ Action act = ( ) =>
114+ {
115+ using var engine = new Engine ( config ) ;
116+ using var module = Module . FromTextFile ( engine , Path . Combine ( "Modules" , "SIMD.wat" ) ) ;
117+ } ;
118+
119+ act . Should ( ) . Throw < WasmtimeException > ( ) ;
120+ }
121+
122+ [ Fact ]
123+ public void ItSetsBulkMemory ( )
124+ {
125+ var config = new Config ( ) ;
126+ config . WithBulkMemory ( false ) ;
127+ config . WithReferenceTypes ( false ) ;
128+
129+ Action act = ( ) =>
130+ {
131+ using var engine = new Engine ( config ) ;
132+ using var module = Module . FromTextFile ( engine , Path . Combine ( "Modules" , "BulkMemory.wat" ) ) ;
133+ } ;
134+
135+ act . Should ( ) . Throw < WasmtimeException > ( ) ;
136+ }
137+
138+ [ Fact ]
139+ public void ItSetsMultiValue ( )
140+ {
141+ var config = new Config ( ) ;
142+ config . WithMultiValue ( false ) ;
143+
144+ Action act = ( ) =>
145+ {
146+ using var engine = new Engine ( config ) ;
147+ using var module = Module . FromTextFile ( engine , Path . Combine ( "Modules" , "MultiValue.wat" ) ) ;
148+ } ;
149+
150+ act . Should ( ) . Throw < WasmtimeException > ( ) ;
151+ }
58152 }
59153}
0 commit comments