Provided tests for functions that can be tested (Closes #20).

This commit is contained in:
2025-01-29 17:45:08 +01:00
parent cd54fdf345
commit c1f2a28ac1
14 changed files with 676 additions and 1 deletions

39
flags/validChar_test.go Normal file
View File

@ -0,0 +1,39 @@
package flags
import "testing"
func TestValidChar(t *testing.T) {
tests := []struct {
name string
char rune
valid bool
}{
{
name: "Valid char",
char: '1',
valid: true,
},
{
name: "Invalid char",
char: 'a',
valid: false,
},
{
name: "Valid char but not relevant",
char: '0',
valid: true,
},
}
flags := Flags{}
// Run tests
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := flags.validChar(tt.char); got != tt.valid {
t.Errorf("validChar() = %v, want %v", got, tt.valid)
}
})
}
}