2020-04-10 21:00:54 +02:00
|
|
|
const (
|
|
|
|
sbuffer_size = 10
|
|
|
|
)
|
|
|
|
|
2020-04-12 01:41:26 +02:00
|
|
|
fn test_hardcoded_static_arr() {
|
2020-10-26 13:41:57 +01:00
|
|
|
myints := [10]int{}
|
2020-04-12 01:41:26 +02:00
|
|
|
size := sizeof(myints)
|
2020-04-10 21:00:54 +02:00
|
|
|
assert size == 40
|
|
|
|
}
|
|
|
|
|
2020-04-12 01:41:26 +02:00
|
|
|
fn test_const_based_static_arr() {
|
2020-10-26 13:41:57 +01:00
|
|
|
myints := [sbuffer_size]int{}
|
2020-04-12 01:41:26 +02:00
|
|
|
size := sizeof(myints)
|
2020-04-10 21:00:54 +02:00
|
|
|
assert size == 40
|
|
|
|
}
|
|
|
|
|
2020-04-12 01:41:26 +02:00
|
|
|
fn test_const_based_static_arr_of_f64() {
|
2020-10-26 13:41:57 +01:00
|
|
|
myf64 := [sbuffer_size]f64{}
|
2020-04-12 01:41:26 +02:00
|
|
|
size := sizeof(myf64)
|
2020-04-10 21:00:54 +02:00
|
|
|
assert size == 80
|
|
|
|
}
|
|
|
|
|
2020-04-12 01:41:26 +02:00
|
|
|
fn test_const_based_static_arr_of_f32() {
|
2020-10-26 13:41:57 +01:00
|
|
|
myf32 := [sbuffer_size]f32{}
|
2020-04-12 01:41:26 +02:00
|
|
|
size := sizeof(myf32)
|
2020-04-10 21:00:54 +02:00
|
|
|
assert size == 40
|
|
|
|
}
|
|
|
|
|
2020-04-12 01:41:26 +02:00
|
|
|
fn test_const_based_static_arr_of_i8() {
|
2020-10-26 13:41:57 +01:00
|
|
|
myi8 := [sbuffer_size]i8{}
|
2020-04-12 01:41:26 +02:00
|
|
|
size := sizeof(myi8)
|
2020-04-10 21:00:54 +02:00
|
|
|
assert size == 10
|
|
|
|
}
|
|
|
|
|
2020-04-12 01:41:26 +02:00
|
|
|
fn test_const_based_static_arr_of_i16() {
|
2020-10-26 13:41:57 +01:00
|
|
|
myi16 := [sbuffer_size]i16{}
|
2020-04-12 01:41:26 +02:00
|
|
|
size := sizeof(myi16)
|
2020-04-10 21:00:54 +02:00
|
|
|
assert size == 20
|
|
|
|
}
|