From 7d1db50294523f6dd94fb97108760193cec620ca Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Fri, 27 Sep 2024 16:26:00 +0300 Subject: [PATCH] update --- enginetest/engine.go | 4 ++-- menu_traversal_test.go | 9 +++------ test_data.json | 3 ++- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/enginetest/engine.go b/enginetest/engine.go index f6ab886..4eed863 100644 --- a/enginetest/engine.go +++ b/enginetest/engine.go @@ -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" diff --git a/menu_traversal_test.go b/menu_traversal_test.go index 091d02e..c674e50 100644 --- a/menu_traversal_test.go +++ b/menu_traversal_test.go @@ -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) } diff --git a/test_data.json b/test_data.json index cc54b50..34bc573 100644 --- a/test_data.json +++ b/test_data.json @@ -1,8 +1,9 @@ { "user_registration": [ { - "input": ["0", "0","1234","1234"], + "input": ["","0", "0","1234","1234"], "expected": "Registration successful" + } ], "pincheck": [