github.com/sandwich-go/boost@v1.3.29/xmath/integer_test.go (about)

     1  package xmath
     2  
     3  import "testing"
     4  
     5  func TestMustParseUint64(t *testing.T) {
     6  	if v := MustParseUint64("12345"); v != 12345 {
     7  		t.Errorf(`MustParseUint64("12345") = %d, want 12345`, v)
     8  	}
     9  	if v := MustParseUint64("0x16"); v != 22 {
    10  		t.Errorf(`MustParseUint64("0x16") = %d, want 22`, v)
    11  	}
    12  }
    13  
    14  func TestMustParseUint64Panic(t *testing.T) {
    15  	defer func() {
    16  		if recover() == nil {
    17  			t.Error("MustParseBig should've panicked")
    18  		}
    19  	}()
    20  	MustParseUint64("ggg")
    21  }