Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
.PHONY: default b build i install r release
.PHONY: default t test b build i install c clean r release

default: build

t test:
go test -v

b build:
go build

i install:
go install

c clean:
go mod tidy

r release:
mkdir -p bin
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o bin/genpno-macos-arm64
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module genpno
module github.com/dominikwinter/genpno

go 1.21.6
32 changes: 32 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package main

import (
"testing"
)

func Test_getRandomDate(t *testing.T) {
date := getRandomDate()

if l := len(date); l != 8 {
t.Errorf("Date is not 8 characters long, but %d", l)
}
}

func Test_getRandomThreeDigits(t *testing.T) {
three := getRandomThreeDigits(true)

if l := len(three); l != 3 {
t.Errorf("Three is not 3 characters long, but %d", l)
}
}

func Test_getChecksum(t *testing.T) {
date := "19800101"
three := "123"

checksum := getChecksum(&date, &three)

if l := len(checksum); l != 1 {
t.Errorf("Checksum is not 2 characters long, but %d", l)
}
}