forked from unidoc/unitype
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtype_test.go
More file actions
52 lines (48 loc) · 887 Bytes
/
type_test.go
File metadata and controls
52 lines (48 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.md', which is part of this source code package.
*/
package unitype
import (
"testing"
)
func TestFixedParts(t *testing.T) {
tcases := []struct {
val fixed
a uint16
b uint16
f64 float64
}{
{
fixed(0x00011000),
0x0001,
0x1000,
1.0625, // FIXME/TODO(gunnsth): Should be 1.1 ?
},
{
fixed(0x00005000),
0x0000,
0x5000,
0.3125, // FIXME/TODO(gunnsth): Should be 0.5 ?
},
{
fixed(0x00025000),
0x0002,
0x5000,
2.3125, // FIXME/TODO(gunnsth): Should be 2.5?
},
}
for _, tcase := range tcases {
a, b := tcase.val.Parts()
if a != tcase.a {
t.Fatalf("%d != %d", a, tcase.a)
}
if b != tcase.b {
t.Fatalf("%d != %d", b, tcase.b)
}
f64 := tcase.val.Float64()
if f64 != tcase.f64 {
t.Fatalf("%v != %v", f64, tcase.f64)
}
}
}