initial commits

master
Charles Iliya Krempeaux 2023-10-27 22:02:38 -07:00
parent 9fe8a0fc3a
commit be887e7e6d
2 changed files with 13 additions and 14 deletions

View File

@ -1,19 +1,18 @@
package hexadeca
package hexadecarunes
import (
"sourcecode.social/reiver/go-hexadeca/enc/runes"
"sourcecode.social/reiver/go-hexadeca/symbols/rune"
)
func EncodeInt64(value int64, symbolFunc func(byte)rune) (r15 rune, r14 rune, r13 rune, r12 rune, r11 rune, r10 rune, r9 rune, r8 rune, r7 rune, r6 rune, r5 rune, r4 rune, r3 rune, r2 rune, r1 rune, r0 rune) {
r15, r14 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 7))), symbolFunc)
r13, r12 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 6))), symbolFunc)
r11, r10 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 5))), symbolFunc)
r9, r8 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 4))), symbolFunc)
r7, r6 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 3))), symbolFunc)
r5, r4 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 2))), symbolFunc)
r3, r2 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 ))), symbolFunc)
r1, r0 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & value ), symbolFunc)
r15, r14 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 7))), symbolFunc)
r13, r12 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 6))), symbolFunc)
r11, r10 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 5))), symbolFunc)
r9, r8 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 4))), symbolFunc)
r7, r6 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 3))), symbolFunc)
r5, r4 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 2))), symbolFunc)
r3, r2 = EncodeByte(byte(0x00000000000000ff & (value >> (8 ))), symbolFunc)
r1, r0 = EncodeByte(byte(0x00000000000000ff & value ), symbolFunc)
return
}

View File

@ -1,9 +1,9 @@
package hexadeca_test
package hexadecarunes_test
import (
"testing"
"sourcecode.social/reiver/go-hexadeca"
"sourcecode.social/reiver/go-hexadeca/runes"
)
func TestEncodeInt64UsingLowerCaseSymbols(t *testing.T) {
@ -842,7 +842,7 @@ func TestEncodeInt64UsingLowerCaseSymbols(t *testing.T) {
for testNumber, test := range tests {
actual15, actual14, actual13, actual12, actual11, actual10, actual9, actual8, actual7, actual6, actual5, actual4, actual3, actual2, actual1, actual0 := hexadeca.EncodeInt64UsingLowerCaseSymbols(test.Value)
actual15, actual14, actual13, actual12, actual11, actual10, actual9, actual8, actual7, actual6, actual5, actual4, actual3, actual2, actual1, actual0 := hexadecarunes.EncodeInt64UsingLowerCaseSymbols(test.Value)
expected15, expected14, expected13, expected12, expected11, expected10, expected9, expected8, expected7, expected6, expected5, expected4, expected3, expected2, expected1, expected0 := test.Expected15, test.Expected14, test.Expected13, test.Expected12, test.Expected11, test.Expected10, test.Expected9, test.Expected8, test.Expected7, test.Expected6, test.Expected5, test.Expected4, test.Expected3, test.Expected2, test.Expected1, test.Expected0
if expected15 != actual15 ||
@ -1706,7 +1706,7 @@ func TestEncodeInt64UsingUpperCaseSymbols(t *testing.T) {
for testNumber, test := range tests {
actual15, actual14, actual13, actual12, actual11, actual10, actual9, actual8, actual7, actual6, actual5, actual4, actual3, actual2, actual1, actual0 := hexadeca.EncodeInt64UsingUpperCaseSymbols(test.Value)
actual15, actual14, actual13, actual12, actual11, actual10, actual9, actual8, actual7, actual6, actual5, actual4, actual3, actual2, actual1, actual0 := hexadecarunes.EncodeInt64UsingUpperCaseSymbols(test.Value)
expected15, expected14, expected13, expected12, expected11, expected10, expected9, expected8, expected7, expected6, expected5, expected4, expected3, expected2, expected1, expected0 := test.Expected15, test.Expected14, test.Expected13, test.Expected12, test.Expected11, test.Expected10, test.Expected9, test.Expected8, test.Expected7, test.Expected6, test.Expected5, test.Expected4, test.Expected3, test.Expected2, test.Expected1, test.Expected0
if expected15 != actual15 ||