MCPcopy Create free account
hub / github.com/github/gh-aw / TestParseIntValueTruncation

Function TestParseIntValueTruncation

pkg/workflow/map_helpers_test.go:76–145  ·  view source on GitHub ↗

TestParseIntValueTruncation tests float truncation scenarios

(t *testing.T)

Source from the content-addressed store, hash-verified

74
75// TestParseIntValueTruncation tests float truncation scenarios
76func TestParseIntValueTruncation(t *testing.T) {
77 tests := []struct {
78 name string
79 value float64
80 expected int
81 shouldTruncate bool
82 }{
83 {
84 name: "clean conversion - no truncation",
85 value: 60.0,
86 expected: 60,
87 shouldTruncate: false,
88 },
89 {
90 name: "truncation required - 60.5",
91 value: 60.5,
92 expected: 60,
93 shouldTruncate: true,
94 },
95 {
96 name: "truncation required - 60.7",
97 value: 60.7,
98 expected: 60,
99 shouldTruncate: true,
100 },
101 {
102 name: "clean conversion - 100.0",
103 value: 100.0,
104 expected: 100,
105 shouldTruncate: false,
106 },
107 {
108 name: "truncation required - 123.99",
109 value: 123.99,
110 expected: 123,
111 shouldTruncate: true,
112 },
113 {
114 name: "truncation required - negative with fraction",
115 value: -5.5,
116 expected: -5,
117 shouldTruncate: true,
118 },
119 {
120 name: "clean conversion - negative integer",
121 value: -10.0,
122 expected: -10,
123 shouldTruncate: false,
124 },
125 {
126 name: "truncation required - small fraction",
127 value: 1.1,
128 expected: 1,
129 shouldTruncate: true,
130 },
131 }
132
133 for _, tt := range tests {

Callers

nothing calls this directly

Calls 3

ParseIntValueFunction · 0.92
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected