functional simple api

This commit is contained in:
2024-08-23 16:39:20 -05:00
parent f9354196dd
commit ae4f12c159
18 changed files with 234 additions and 216 deletions

View File

@@ -2,13 +2,13 @@ package nkode
import (
"github.com/stretchr/testify/assert"
"go-nkode/core/model"
py_builtin "go-nkode/py-builtin"
m "go-nkode/core/model"
py "go-nkode/py-builtin"
"testing"
)
func TestUserCipherKeys_EncipherSaltHashCode(t *testing.T) {
keypadSize := model.KeypadSize{AttrsPerKey: 10, NumbOfKeys: 5}
keypadSize := m.KeypadSize{AttrsPerKey: 10, NumbOfKeys: 5}
maxNKodeLen := 10
customerAttrs, err := NewCustomerAttributes(keypadSize)
assert.NoError(t, err)
@@ -22,7 +22,7 @@ func TestUserCipherKeys_EncipherSaltHashCode(t *testing.T) {
}
func TestUserCipherKeys_EncipherDecipherMask(t *testing.T) {
keypadSize := model.KeypadSize{AttrsPerKey: 10, NumbOfKeys: 5}
keypadSize := m.KeypadSize{AttrsPerKey: 10, NumbOfKeys: 5}
maxNKodeLen := 10
customerAttrs, err := NewCustomerAttributes(keypadSize)
@@ -48,7 +48,7 @@ func TestUserCipherKeys_EncipherDecipherMask(t *testing.T) {
}
func TestUserInterface_RandomShuffle(t *testing.T) {
keypadSize := model.KeypadSize{
keypadSize := m.KeypadSize{
AttrsPerKey: 10,
NumbOfKeys: 5,
}
@@ -73,7 +73,7 @@ func TestUserInterface_RandomShuffle(t *testing.T) {
func TestUserInterface_DisperseInterface(t *testing.T) {
for idx := 0; idx < 10000; idx++ {
keypadSize := model.KeypadSize{AttrsPerKey: 7, NumbOfKeys: 10}
keypadSize := m.KeypadSize{AttrsPerKey: 7, NumbOfKeys: 10}
userInterface, err := NewUserInterface(keypadSize)
assert.NoError(t, err)
@@ -92,7 +92,7 @@ func TestUserInterface_DisperseInterface(t *testing.T) {
}
func TestUserInterface_PartialInterfaceShuffle(t *testing.T) {
keypadSize := model.KeypadSize{AttrsPerKey: 7, NumbOfKeys: 10}
keypadSize := m.KeypadSize{AttrsPerKey: 7, NumbOfKeys: 10}
userInterface, err := NewUserInterface(keypadSize)
assert.NoError(t, err)
preShuffle := userInterface.IdxInterface
@@ -105,12 +105,12 @@ func TestUserInterface_PartialInterfaceShuffle(t *testing.T) {
shuffleCompare[idx] = val == postShuffle[idx]
}
allTrue := py_builtin.All[bool](shuffleCompare, func(n bool) bool {
allTrue := py.All[bool](shuffleCompare, func(n bool) bool {
return n == true
})
assert.False(t, allTrue)
allFalse := py_builtin.All[bool](shuffleCompare, func(n bool) bool {
allFalse := py.All[bool](shuffleCompare, func(n bool) bool {
return n == false
})