MCPcopy Create free account
hub / github.com/apache/devlake / TestParseInt

Function TestParseInt

backend/plugins/q_dev/tasks/s3_data_extractor_test.go:589–604  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

587}
588
589func TestParseInt(t *testing.T) {
590 fieldMap := map[string]string{
591 "ValidInt": "42",
592 "ZeroInt": "0",
593 "NegativeInt": "-10",
594 "InvalidInt": "not-a-number",
595 "EmptyString": "",
596 }
597
598 assert.Equal(t, 42, parseInt(fieldMap, "ValidInt"))
599 assert.Equal(t, 0, parseInt(fieldMap, "ZeroInt"))
600 assert.Equal(t, -10, parseInt(fieldMap, "NegativeInt"))
601 assert.Equal(t, 0, parseInt(fieldMap, "InvalidInt"))
602 assert.Equal(t, 0, parseInt(fieldMap, "EmptyString"))
603 assert.Equal(t, 0, parseInt(fieldMap, "NonExistentField"))
604}

Callers

nothing calls this directly

Calls 1

parseIntFunction · 0.85

Tested by

no test coverage detected