menu-traversals #108
@ -26,8 +26,8 @@ func TestEngine(sessionId string) (engine.Engine,*persist.Persister){
|
|||||||
cfg := engine.Config{
|
cfg := engine.Config{
|
||||||
Root: "root",
|
Root: "root",
|
||||||
SessionId: sessionId,
|
SessionId: sessionId,
|
||||||
OutputSize: uint32(106),
|
OutputSize: uint32(160),
|
||||||
FlagCount: uint32(16),
|
//FlagCount: uint32(16),
|
||||||
}
|
}
|
||||||
|
|
||||||
dbDir := ".test_state"
|
dbDir := ".test_state"
|
||||||
|
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -30,8 +29,8 @@ type TestData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUserRegistration(t *testing.T) {
|
func TestUserRegistration(t *testing.T) {
|
||||||
en, pe := enginetest.TestEngine("session1234112")
|
en, pe := enginetest.TestEngine("session12341122")
|
||||||
w := bytes.NewBuffer(nil)
|
//w := bytes.NewBuffer(nil)
|
||||||
file, err := os.Open("test_data.json")
|
file, err := os.Open("test_data.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error opening file:", err)
|
fmt.Println("Error opening file:", err)
|
||||||
@ -51,11 +50,9 @@ func TestUserRegistration(t *testing.T) {
|
|||||||
inputBuilder.WriteString(strings.Join(testCase.Input, "\n") + "\n")
|
inputBuilder.WriteString(strings.Join(testCase.Input, "\n") + "\n")
|
||||||
}
|
}
|
||||||
readers := bufio.NewReader(strings.NewReader(inputBuilder.String()))
|
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()
|
st := pe.GetState()
|
||||||
sym, _ := st.Where()
|
sym, _ := st.Where()
|
||||||
b := w.Bytes()
|
|
||||||
fmt.Println("Menu:",string(b))
|
|
||||||
fmt.Println("Rendering symbol:", sym)
|
fmt.Println("Rendering symbol:", sym)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"user_registration": [
|
"user_registration": [
|
||||||
{
|
{
|
||||||
"input": ["0", "0","1234","1234"],
|
"input": ["","0", "0","1234","1234"],
|
||||||
"expected": "Registration successful"
|
"expected": "Registration successful"
|
||||||
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"pincheck": [
|
"pincheck": [
|
||||||
|
Loading…
Reference in New Issue
Block a user