Download java-sdk/src/test/java/vm/MainTest.java from Snapkitty/perplexity-macro-vm: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/Snapkitty/perplexity-macro-vm/resolve/main/java-sdk/src/test/java/vm/MainTest.java
- Command line
-
hf download hf://Snapkitty/perplexity-macro-vm/java-sdk/src/test/java/vm/MainTest.java
-
curl -L -o MainTest.java https://huggingface.co/Snapkitty/perplexity-macro-vm/resolve/main/java-sdk/src/test/java/vm/MainTest.java
1.29 kB
| package vm; | |
| import org.junit.Test; | |
| import static org.junit.Assert.*; | |
| public class MainTest { | |
| public void testExecuteReturnsResult() { | |
| String result = Main.execute("int x = 2 + 2;"); | |
| assertNotNull(result); | |
| assertTrue(result.contains("executed")); | |
| assertTrue(result.contains("4 chars")); | |
| } | |
| public void testCapabilityRequest() { | |
| // Capability.request is native (WASM import) — in unit tests it throws | |
| // This test verifies the class loads and the method signature is correct | |
| try { | |
| Capability.request("search", "{\"query\":\"test\"}"); | |
| fail("Should throw UnsatisfiedLinkError in unit test (native WASM import)"); | |
| } catch (UnsatisfiedLinkError e) { | |
| // Expected — native methods only work in WASM runtime | |
| assertTrue(e.getMessage().contains("vm")); | |
| } | |
| } | |
| public void testWasmClassLoads() { | |
| // Wasm.memorySize is native — verify class loads | |
| try { | |
| Wasm.memorySize(); | |
| fail("Should throw UnsatisfiedLinkError in unit test"); | |
| } catch (UnsatisfiedLinkError e) { | |
| assertTrue(e.getMessage().contains("vm")); | |
| } | |
| } | |
| } | |