Day 2: Part 1

This commit is contained in:
James Griffin
2020-12-02 12:41:39 -04:00
parent 1225256007
commit 004b5c07a8
5 changed files with 1128 additions and 3 deletions

28
two/day_two_test.go Normal file
View File

@@ -0,0 +1,28 @@
package two
import "testing"
func Test_db_load(t *testing.T) {
database := db{}
if err := database.load("sample.txt"); err != nil {
t.Log(err)
t.FailNow()
}
if len(database.passwords) != 3 {
t.Logf("Expected 3 passwords, Got %d passwords", len(database.passwords))
t.FailNow()
}
}
func Test_db_valiate(t *testing.T) {
database := db{}
database.load("sample.txt")
validCount := database.validate()
if validCount != 2 {
t.Logf("Expected 2 valid passwords, Got %d valid passwords", validCount)
t.FailNow()
}
}