Skip to content

Commit

Permalink
added a basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
ArunMurugan78 committed Dec 16, 2021
1 parent 211fa72 commit 05a1dcc
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions bfuk_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package bfuk_test

import (
"bufio"
"bytes"
"log"
"os"
"strings"
"testing"

"github.com/arunmurugan78/bfuk"
)

func TestBfuk(t *testing.T) {

r := bufio.NewReader(strings.NewReader(">+++++++++++++++++++++++++++++++++++++++++++++++++++<>>>><<<."))

bf := bfuk.NewBfuk(r)

s := bytes.NewBufferString("")

reader := bufio.NewReader(os.Stdin)
writer := bufio.NewWriter(s)

bf.Run(reader, writer)
writer.Flush()

if s.String() != "3" {
log.Fatalln("expected 3")
}
}

0 comments on commit 05a1dcc

Please sign in to comment.