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

Function TestIsPositiveInteger

pkg/stringutil/stringutil_test.go:489–553  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

487}
488
489func TestIsPositiveInteger(t *testing.T) {
490 tests := []struct {
491 name string
492 s string
493 want bool
494 }{
495 {
496 name: "positive integer",
497 s: "123",
498 want: true,
499 },
500 {
501 name: "one",
502 s: "1",
503 want: true,
504 },
505 {
506 name: "large number",
507 s: "999999999",
508 want: true,
509 },
510 {
511 name: "zero",
512 s: "0",
513 want: false,
514 },
515 {
516 name: "negative",
517 s: "-5",
518 want: false,
519 },
520 {
521 name: "leading zeros",
522 s: "007",
523 want: false,
524 },
525 {
526 name: "float",
527 s: "3.14",
528 want: false,
529 },
530 {
531 name: "not a number",
532 s: "abc",
533 want: false,
534 },
535 {
536 name: "empty string",
537 s: "",
538 want: false,
539 },
540 {
541 name: "spaces",
542 s: " 123 ",
543 want: false,
544 },
545 }
546

Callers

nothing calls this directly

Calls 2

IsPositiveIntegerFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected