Skip to content

Commit

Permalink
minitrue: Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
earthboundkid committed May 22, 2023
1 parent 4314efd commit 7461444
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions internal/minitrue/minitrue_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package minitrue_test

import (
"testing"

"github.com/carlmjohnson/requests/internal/be"
"github.com/carlmjohnson/requests/internal/minitrue"
)

func TestCond(t *testing.T) {
be.Equal(t, 1, minitrue.Cond(true, 1, 2))
be.Equal(t, 2, minitrue.Cond(false, 1, 2))
}

func TestOr(t *testing.T) {
be.Equal(t, 0, minitrue.Or[int]())
be.Equal(t, 0, minitrue.Or(0))
be.Equal(t, 1, minitrue.Or(1))
be.Equal(t, 2, minitrue.Or(0, 2))
be.Equal(t, 3, minitrue.Or(0, 0, 3))
}

0 comments on commit 7461444

Please sign in to comment.