1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/runtime/runtime_test.v

54 lines
1.1 KiB
V
Raw Normal View History

2019-10-11 06:36:46 +03:00
import runtime
fn test_physical_memory() {
total := runtime.total_memory()
free := runtime.free_memory()
println('total memory: ${total}')
println('free memory: ${free}')
assert total > 0 && free > 0
}
2019-10-11 06:36:46 +03:00
fn test_nr_cpus() {
nr_cpus := runtime.nr_cpus()
println(' nr cpus: ${nr_cpus}')
assert nr_cpus > 0
}
fn test_nr_jobs() {
nr_jobs := runtime.nr_jobs()
println(' nr jobs: ${nr_jobs}')
assert nr_jobs > 0
}
fn test_is_32bit() {
x := runtime.is_32bit().str()
println(' is_32bit: ${x}')
assert x == 'true' || x == 'false'
}
fn test_is_64bit() {
x := runtime.is_64bit().str()
println(' is_64bit: ${x}')
assert x == 'true' || x == 'false'
}
fn test_is_little_endian() {
x := runtime.is_little_endian().str()
println(' is_le: ${x}')
assert x == 'true' || x == 'false'
}
fn test_is_big_endian() {
x := runtime.is_big_endian().str()
println(' is_be: ${x}')
assert x == 'true' || x == 'false'
}
fn test_is_big_endian_different_than_is_little_endian() {
assert runtime.is_big_endian() != runtime.is_little_endian()
}
fn test_is_32bit_different_than_is_64bit() {
assert runtime.is_32bit() != runtime.is_64bit()
}