From be887e7e6d70edeb088fb3e26ba00d7ff8020137 Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Fri, 27 Oct 2023 22:02:38 -0700 Subject: [PATCH] initial commits --- encodeint64.go => runes/encodeint64.go | 19 +++++++++---------- .../encodeint64_test.go | 8 ++++---- 2 files changed, 13 insertions(+), 14 deletions(-) rename encodeint64.go => runes/encodeint64.go (56%) rename encodeint64_test.go => runes/encodeint64_test.go (99%) diff --git a/encodeint64.go b/runes/encodeint64.go similarity index 56% rename from encodeint64.go rename to runes/encodeint64.go index af74662..a694549 100644 --- a/encodeint64.go +++ b/runes/encodeint64.go @@ -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 } diff --git a/encodeint64_test.go b/runes/encodeint64_test.go similarity index 99% rename from encodeint64_test.go rename to runes/encodeint64_test.go index b97e1ab..473c5fc 100644 --- a/encodeint64_test.go +++ b/runes/encodeint64_test.go @@ -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 ||