aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/v/tests/array_cast_test.v
diff options
context:
space:
mode:
Diffstat (limited to 'v_windows/v/old/vlib/v/tests/array_cast_test.v')
-rw-r--r--v_windows/v/old/vlib/v/tests/array_cast_test.v19
1 files changed, 19 insertions, 0 deletions
diff --git a/v_windows/v/old/vlib/v/tests/array_cast_test.v b/v_windows/v/old/vlib/v/tests/array_cast_test.v
new file mode 100644
index 0000000..072e6a5
--- /dev/null
+++ b/v_windows/v/old/vlib/v/tests/array_cast_test.v
@@ -0,0 +1,19 @@
+fn test_array_cast() {
+ mut keys := ['']
+ unsafe {
+ vp := voidptr(&keys)
+ mut p := &[]string(vp)
+ (*p)[0] = 'hi'
+ assert *p == ['hi']
+ }
+ assert keys[0] == 'hi'
+}
+
+fn test_int() {
+ mut arr := [2.3, 3]
+ unsafe {
+ vp := voidptr(&arr)
+ p := &[]f64(vp)
+ assert *p == arr
+ }
+}