Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

import "testing"

func TestPasswordHashing(t *testing.T) {
password := "secret123"
hash, err := HashPassword(password)
if err != nil {
t.Fatalf("HashPassword returned error: %v", err)
}
if hash == password {
t.Fatalf("hash should not equal the original password")
}
if !CheckPasswordHash(password, hash) {
t.Fatalf("CheckPasswordHash should return true for correct password")
}
}