From 17a2a394f61ef92af234a357f88cc4afb61c73d1 Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Fri, 27 Oct 2023 21:45:20 -0700 Subject: [PATCH] initial commits --- encodeuint64.go => enc/runes/encodeuint64.go | 19 +++++++++---------- .../runes/encodeuint64_test.go | 8 ++++---- 2 files changed, 13 insertions(+), 14 deletions(-) rename encodeuint64.go => enc/runes/encodeuint64.go (56%) rename encodeuint64_test.go => enc/runes/encodeuint64_test.go (99%) diff --git a/encodeuint64.go b/enc/runes/encodeuint64.go similarity index 56% rename from encodeuint64.go rename to enc/runes/encodeuint64.go index 215eba5..6c84800 100644 --- a/encodeuint64.go +++ b/enc/runes/encodeuint64.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 EncodeUint64(value uint64, 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/encodeuint64_test.go b/enc/runes/encodeuint64_test.go similarity index 99% rename from encodeuint64_test.go rename to enc/runes/encodeuint64_test.go index e24efbd..6d561e8 100644 --- a/encodeuint64_test.go +++ b/enc/runes/encodeuint64_test.go @@ -1,9 +1,9 @@ -package hexadeca_test +package hexadecarunes_test import ( "testing" - "sourcecode.social/reiver/go-hexadeca" + "sourcecode.social/reiver/go-hexadeca/enc/runes" ) func TestEncodeUint64UsingLowerCaseSymbols(t *testing.T) { @@ -842,7 +842,7 @@ func TestEncodeUint64UsingLowerCaseSymbols(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.EncodeUint64UsingLowerCaseSymbols(test.Value) + actual15, actual14, actual13, actual12, actual11, actual10, actual9, actual8, actual7, actual6, actual5, actual4, actual3, actual2, actual1, actual0 := hexadecarunes.EncodeUint64UsingLowerCaseSymbols(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 TestEncodeUint64UsingUpperCaseSymbols(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.EncodeUint64UsingUpperCaseSymbols(test.Value) + actual15, actual14, actual13, actual12, actual11, actual10, actual9, actual8, actual7, actual6, actual5, actual4, actual3, actual2, actual1, actual0 := hexadecarunes.EncodeUint64UsingUpperCaseSymbols(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 ||