Files
zeekay 7cf87b230b node-unified is the node
The module already called itself github.com/luxfi/node while containing no node
in Go: cmd/luxd was twenty-one lines that printed the size of a few types, and
the Go column of the matrix measured a VM plugin. A repo that fetches the thing
it claims to be has not replaced it, so the Go sources move in — 1515 files,
the daemon and everything under it — and the build reaches outside this module
for nothing.

Rust and C++ sit beside it unchanged and are still measured against it by the
differential. That is the point of one repo: the reference implementation and
the two ports are the same checkout, so parity is a thing you can run rather
than a thing you assert.

Verified: builds, and the closure carries no lux-private — checked at build time
rather than believed. The daemon starts twelve chains on a local network
(P X C Q Z A B G K M F, plus D through its plugin) and reports healthy.
2026-09-07 16:15:25 -07:00

75 lines
1.5 KiB
Go

// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package cb58
import (
"bytes"
"testing"
"github.com/stretchr/testify/require"
)
// Test encoding bytes to a string and decoding back to bytes
func TestEncodeDecode(t *testing.T) {
require := require.New(t)
type test struct {
bytes []byte
str string
}
id := [32]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}
tests := []test{
{
nil,
"45PJLL",
},
{
[]byte{},
"45PJLL",
},
{
[]byte{0},
"1c7hwa",
},
{
[]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255},
"1NVSVezva3bAtJesnUj",
},
{
id[:],
"SkB92YpWm4Q2ijQHH34cqbKkCZWszsiQgHVjtNeFF2HdvDQU",
},
}
for _, test := range tests {
// Encode the bytes
strResult, err := Encode(test.bytes)
require.NoError(err)
// Make sure the string repr. is what we expected
require.Equal(test.str, strResult)
// Decode the string
bytesResult, err := Decode(strResult)
require.NoError(err)
// Make sure we got the same bytes back
require.True(bytes.Equal(test.bytes, bytesResult))
}
}
func FuzzEncodeDecode(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
require := require.New(t)
// Encode bytes to string
dataStr, err := Encode(data)
require.NoError(err)
// Decode string to bytes
gotData, err := Decode(dataStr)
require.NoError(err)
require.Equal(data, gotData)
})
}