MCPcopy Index your code
hub / github.com/Masterminds/sprig / TestToFloat64

Function TestToFloat64

numeric_test.go:84–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

82}
83
84func TestToFloat64(t *testing.T) {
85 target := float64(102)
86 if target != toFloat64(int8(102)) {
87 t.Errorf("Expected 102")
88 }
89 if target != toFloat64(int(102)) {
90 t.Errorf("Expected 102")
91 }
92 if target != toFloat64(int32(102)) {
93 t.Errorf("Expected 102")
94 }
95 if target != toFloat64(int16(102)) {
96 t.Errorf("Expected 102")
97 }
98 if target != toFloat64(int64(102)) {
99 t.Errorf("Expected 102")
100 }
101 if target != toFloat64("102") {
102 t.Errorf("Expected 102")
103 }
104 if 0 != toFloat64("frankie") {
105 t.Errorf("Expected 0")
106 }
107 if target != toFloat64(uint16(102)) {
108 t.Errorf("Expected 102")
109 }
110 if target != toFloat64(uint64(102)) {
111 t.Errorf("Expected 102")
112 }
113 if 102.1234 != toFloat64(float64(102.1234)) {
114 t.Errorf("Expected 102.1234")
115 }
116 if 1 != toFloat64(true) {
117 t.Errorf("Expected 102")
118 }
119}
120func TestToInt64(t *testing.T) {
121 target := int64(102)
122 if target != toInt64(int8(102)) {

Callers

nothing calls this directly

Calls 1

toFloat64Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…