MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestBinaryToDecimal

Function TestBinaryToDecimal

conversion/binarytodecimal_test.go:29–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27}
28
29func TestBinaryToDecimal(t *testing.T) {
30 for input, expected := range binaryTestCases {
31 out, err := BinaryToDecimal(input)
32 if err != nil {
33 t.Errorf("BinaryToDecimal(%s) returned an error %s", input, err.Error())
34 }
35 if out != expected {
36 t.Errorf("BinaryToDecimal(%s) = %d; want %d", input, out, expected)
37 }
38 }
39}
40
41func BenchmarkBinaryToDecimal(b *testing.B) {
42 b.ReportAllocs()

Callers

nothing calls this directly

Calls 1

BinaryToDecimalFunction · 0.85

Tested by

no test coverage detected