github.com/frodejac/aoc-2022@v0.0.0-20221213081734-037c741b1c89/pkg/math/math_test.go (about)

     1  package math
     2  
     3  import "testing"
     4  
     5  func TestMax(t *testing.T) {
     6  	x := 1
     7  	y := 2
     8  	max := Max(x, y)
     9  	if max != 2 {
    10  		t.Errorf("Expected max to be 2, got %d", max)
    11  	}
    12  
    13  	x = 2
    14  	max = Max(x, y)
    15  	if max != 2 {
    16  		t.Errorf("Expected max to be 2, got %d", max)
    17  	}
    18  }
    19  
    20  func TestMin(t *testing.T) {
    21  	x := 1
    22  	y := 2
    23  	min := Min(x, y)
    24  	if min != 1 {
    25  		t.Errorf("Expected min to be 1, got %d", min)
    26  	}
    27  
    28  	x = 2
    29  	min = Min(x, y)
    30  	if min != 2 {
    31  		t.Errorf("Expected min to be 2, got %d", min)
    32  	}
    33  }