Compare commits

..

No commits in common. "fce9b28f6d0eae01719977962f9aff14f39a9d1a" and "61afa170002a71b1745d89bc0285f9cf01e8e20d" have entirely different histories.

4 changed files with 0 additions and 158 deletions

View File

@ -1,18 +0,0 @@
package rfc2234
// IsAlpha returns true if the value of 'r' matches 'ALPHA' as defined in IETF RFC-2234:
//
// ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
func IsAlpha(r rune) bool {
if 'z' < r {
return false
}
if r < 'A' {
return false
}
if 'Z' < r && r < 'a'{
return false
}
return true
}

View File

@ -1,75 +0,0 @@
package rfc2234_test
import (
"testing"
"sourcecode.social/reiver/go-rfc2234"
)
func TestIsAlpha(t *testing.T) {
tests := []struct{
Rune rune
Expected bool
}{
}
for r:=rune(0); r < 'A'; r++ {
tests = append(tests, struct{
Rune rune
Expected bool
}{
Rune: r,
Expected: false,
})
}
for r:='A'; r <= 'Z'; r++ {
tests = append(tests, struct{
Rune rune
Expected bool
}{
Rune: r,
Expected: true,
})
}
for r:='Z'+1; r < 'a'; r++ {
tests = append(tests, struct{
Rune rune
Expected bool
}{
Rune: r,
Expected: false,
})
}
for r:='a'; r <= 'z'; r++ {
tests = append(tests, struct{
Rune rune
Expected bool
}{
Rune: r,
Expected: true,
})
}
for r:='z'+1; r <= rune(127); r++ {
tests = append(tests, struct{
Rune rune
Expected bool
}{
Rune: r,
Expected: false,
})
}
for testNumber, test := range tests {
actual := rfc2234.IsAlpha(test.Rune)
expected := test.Expected
if expected != actual {
t.Errorf("For test #%d, the actual value for rfc2234.IsAlpha() is not what was expected.", testNumber)
t.Logf("EXPECTED: %t", expected)
t.Logf("ACTUAL: %t", actual)
t.Logf("RUNE: (%U) %q", test.Rune, string(test.Rune))
continue
}
}
}

View File

@ -1,8 +0,0 @@
package rfc2234
// IsDigit returns true if value of 'r' matches 'ALPHA' as defined in IETF RFC-2234:
//
// DIGIT = %30-%39 ; 0-9
func IsDigit(r rune) bool {
return '0' <= r && r <= '9'
}

View File

@ -1,57 +0,0 @@
package rfc2234_test
import (
"testing"
"sourcecode.social/reiver/go-rfc2234"
)
func TestIsDigit(t *testing.T) {
tests := []struct{
Rune rune
Expected bool
}{
}
for r:=rune(0); r < '0'; r++ {
tests = append(tests, struct{
Rune rune
Expected bool
}{
Rune: r,
Expected: false,
})
}
for r:='0'; r <= '9'; r++ {
tests = append(tests, struct{
Rune rune
Expected bool
}{
Rune: r,
Expected: true,
})
}
for r:='9'+1; r <= rune(127); r++ {
tests = append(tests, struct{
Rune rune
Expected bool
}{
Rune: r,
Expected: false,
})
}
for testNumber, test := range tests {
actual := rfc2234.IsDigit(test.Rune)
expected := test.Expected
if expected != actual {
t.Errorf("For test #%d, the actual value for rfc2234.IsDigit() is not what was expected.", testNumber)
t.Logf("EXPECTED: %t", expected)
t.Logf("ACTUAL: %t", actual)
t.Logf("RUNE: (%U) %q", test.Rune, string(test.Rune))
continue
}
}
}