mirror of
https://github.com/GaloisInc/cryptol.git
synced 2024-09-11 14:06:13 +03:00
FFI: Add test for runtime errors
This commit is contained in:
parent
8a274d08b1
commit
4fd7e175d9
10
tests/ffi/ffi-runtime-errors.c
Normal file
10
tests/ffi/ffi-runtime-errors.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t f(size_t n, uint8_t *p) {
|
||||
return n == 0;
|
||||
}
|
||||
|
||||
uint8_t g(uint8_t x) {
|
||||
return x;
|
||||
}
|
2
tests/ffi/ffi-runtime-errors.cry
Normal file
2
tests/ffi/ffi-runtime-errors.cry
Normal file
@ -0,0 +1,2 @@
|
||||
foreign f : {n} (fin n, n >= 2^^64) => [n - 2^^64][8] -> Bit
|
||||
foreign g : Bit -> Bit
|
9
tests/ffi/ffi-runtime-errors.icry
Normal file
9
tests/ffi/ffi-runtime-errors.icry
Normal file
@ -0,0 +1,9 @@
|
||||
:! make -s ffi-runtime-errors
|
||||
:l ffi-runtime-errors.cry
|
||||
|
||||
f []
|
||||
|
||||
:prove g
|
||||
:sat g
|
||||
:safe g
|
||||
:eval g
|
28
tests/ffi/ffi-runtime-errors.icry.stdout
Normal file
28
tests/ffi/ffi-runtime-errors.icry.stdout
Normal file
@ -0,0 +1,28 @@
|
||||
Loading module Cryptol
|
||||
Loading module Cryptol
|
||||
Loading module Main
|
||||
|
||||
numeric type argument to foreign function is too large: 18446744073709551616
|
||||
in type parameter n`899 of function Main::f
|
||||
type arguments must fit in a C `size_t`
|
||||
-- Backtrace --
|
||||
Main::f called at ffi-runtime-errors.icry:4:1--4:2
|
||||
|
||||
cannot call foreign function Main::g
|
||||
FFI calls are not supported in this context
|
||||
If you are trying to evaluate an expression, try rebuilding
|
||||
Cryptol with FFI support enabled.
|
||||
|
||||
cannot call foreign function Main::g
|
||||
FFI calls are not supported in this context
|
||||
If you are trying to evaluate an expression, try rebuilding
|
||||
Cryptol with FFI support enabled.
|
||||
|
||||
cannot call foreign function Main::g
|
||||
FFI calls are not supported in this context
|
||||
If you are trying to evaluate an expression, try rebuilding
|
||||
Cryptol with FFI support enabled.
|
||||
cannot call foreign function Main::g
|
||||
FFI calls are not supported in this context
|
||||
If you are trying to evaluate an expression, try rebuilding
|
||||
Cryptol with FFI support enabled.
|
Loading…
Reference in New Issue
Block a user