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

Function TestDecimalToBinary

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

DecimalToBinaryFunction · 0.85

Tested by

no test coverage detected