This commit is contained in:
Carlosokumu 2024-09-27 16:26:00 +03:00
parent afe98b8695
commit 7d1db50294
Signed by untrusted user: carlos
GPG Key ID: 7BD6BC8160A5C953
3 changed files with 7 additions and 9 deletions

View File

@ -26,8 +26,8 @@ func TestEngine(sessionId string) (engine.Engine,*persist.Persister){
cfg := engine.Config{
Root: "root",
SessionId: sessionId,
OutputSize: uint32(106),
FlagCount: uint32(16),
OutputSize: uint32(160),
//FlagCount: uint32(16),
}
dbDir := ".test_state"

View File

@ -2,7 +2,6 @@ package main
import (
"bufio"
"bytes"
"context"
"encoding/json"
"fmt"
@ -30,8 +29,8 @@ type TestData struct {
}
func TestUserRegistration(t *testing.T) {
en, pe := enginetest.TestEngine("session1234112")
w := bytes.NewBuffer(nil)
en, pe := enginetest.TestEngine("session12341122")
//w := bytes.NewBuffer(nil)
file, err := os.Open("test_data.json")
if err != nil {
fmt.Println("Error opening file:", err)
@ -51,11 +50,9 @@ func TestUserRegistration(t *testing.T) {
inputBuilder.WriteString(strings.Join(testCase.Input, "\n") + "\n")
}
readers := bufio.NewReader(strings.NewReader(inputBuilder.String()))
engine.Loop(context.Background(), en, readers, w, nil)
engine.Loop(context.Background(), en, readers, os.Stdout, nil)
st := pe.GetState()
sym, _ := st.Where()
b := w.Bytes()
fmt.Println("Menu:",string(b))
fmt.Println("Rendering symbol:", sym)
}

View File

@ -1,8 +1,9 @@
{
"user_registration": [
{
"input": ["0", "0","1234","1234"],
"input": ["","0", "0","1234","1234"],
"expected": "Registration successful"
}
],
"pincheck": [