go-hexadeca/symbols/rune/persian_test.go

96 lines
1.3 KiB
Go
Raw Normal View History

2023-10-27 18:58:14 +00:00
package runesymbols_test
2023-10-26 23:54:31 +00:00
import (
"testing"
2023-10-27 18:58:14 +00:00
"sourcecode.social/reiver/go-hexadeca/symbols/rune"
2023-10-26 23:54:31 +00:00
)
2023-10-27 18:58:14 +00:00
func TestPersian(t *testing.T) {
2023-10-26 23:54:31 +00:00
tests := []struct{
Value byte
Expected rune
}{
{
Value: 0,
Expected: '۰',
},
{
Value: 1,
Expected: '۱',
},
{
Value: 2,
Expected: '۲',
},
{
Value: 3,
Expected: '۳',
},
{
Value: 4,
Expected: '۴',
},
{
Value: 5,
Expected: '۵',
},
{
Value: 6,
Expected: '۶',
},
{
Value: 7,
Expected: '۷',
},
{
Value: 8,
Expected: '۸',
},
{
Value: 9,
Expected: '۹',
},
{
Value: 10,
2023-10-27 20:12:00 +00:00
Expected: 'ی',
2023-10-26 23:54:31 +00:00
},
{
Value: 11,
2023-10-27 20:12:00 +00:00
Expected: 'ک',
2023-10-26 23:54:31 +00:00
},
{
Value: 12,
2023-10-27 20:12:00 +00:00
Expected: 'ل',
2023-10-26 23:54:31 +00:00
},
{
Value: 13,
2023-10-27 20:12:00 +00:00
Expected: 'م',
2023-10-26 23:54:31 +00:00
},
{
Value: 14,
2023-10-27 20:12:00 +00:00
Expected: 'ن',
2023-10-26 23:54:31 +00:00
},
{
Value: 15,
2023-10-27 20:12:00 +00:00
Expected: 'س',
2023-10-26 23:54:31 +00:00
},
}
for testNumber, test := range tests {
2023-10-27 18:58:14 +00:00
actual := runesymbols.Persian(test.Value)
2023-10-26 23:54:31 +00:00
expected := test.Expected
if expected != actual {
t.Errorf("For test #%d, the actual value is not what was expected.", testNumber)
t.Logf("EXPECTED: %q (%d)", expected, expected)
t.Logf("ACTUAL: %q (%d)", actual, actual)
t.Logf("VALUE: %x (%d)", test.Value, test.Value)
continue
}
}
}