v2 / vlib / json / tests / json_f64_array_roundtrip_test.v
14 lines · 12 sloc · 358 bytes · 4f04f7245854ccbfadb86ef7774f53477f71da87
Raw
1import json
2
3struct F64ArrayPayload {
4 arr []f64
5}
6
7fn test_encode_decode_struct_with_f64_array_roundtrips() ! {
8 original := F64ArrayPayload{
9 arr: [0.9716157205240175, 0.9336099585062241]
10 }
11 encoded := json.encode(original)
12 assert encoded == '{"arr":[0.9716157205240175,0.9336099585062241]}'
13 assert json.decode(F64ArrayPayload, encoded)! == original
14}
15