mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +01:00
Add compileToBinary() for samples
This commit is contained in:
parent
5c7b7256c7
commit
cf71920447
@ -15,12 +15,13 @@
|
||||
*/
|
||||
package de.inetsoftware.jwebassembly;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
@ -76,4 +77,17 @@ public class SampleCompileTest {
|
||||
String text = webAsm.compileToText();
|
||||
assertEquals( expected, text );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compileToBinary() throws Exception {
|
||||
URL url = SampleCompileTest.class.getResource( "samples/" + testName + ".wasm" );
|
||||
File wasmFile = new File( url.toURI() );
|
||||
byte[] expected = Files.readAllBytes( wasmFile.toPath() );
|
||||
JWebAssembly webAsm = new JWebAssembly();
|
||||
webAsm.addFile( classFile );
|
||||
byte[] actual = webAsm.compileToBinary();
|
||||
System.err.println(Arrays.toString( expected ));
|
||||
System.err.println(Arrays.toString( actual ));
|
||||
assertArrayEquals( expected, actual );
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
BIN
test/de/inetsoftware/jwebassembly/samples/basic/EmptyClass.wasm
Normal file
BIN
test/de/inetsoftware/jwebassembly/samples/basic/EmptyClass.wasm
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user