1
0
forked from Mirror/wren
Files
wren/test/api/returns.wren
Bob Nystrom 01e8f9053e Add a benchmark to test the Wren C API.
I've got some ideas on how to tweak the embedding API, but I want to
see what performance impact they have first, so this adds a little
benchmark that just calls a foreign method a ton of times.
2015-12-15 16:02:13 -08:00

24 lines
623 B
Plaintext

class Returns {
foreign static implicitNull
foreign static returnInt
foreign static returnFloat
foreign static returnTrue
foreign static returnFalse
foreign static returnString
foreign static returnBytes
}
System.print(Returns.implicitNull == null) // expect: true
System.print(Returns.returnInt) // expect: 123456
System.print(Returns.returnFloat) // expect: 123.456
System.print(Returns.returnTrue) // expect: true
System.print(Returns.returnFalse) // expect: false
System.print(Returns.returnString) // expect: a string
System.print(Returns.returnBytes.bytes.toList) // expect: [97, 0, 98, 0, 99]