()
| 18 | } |
| 19 | |
| 20 | func getTests() []struct { |
| 21 | name string |
| 22 | n int |
| 23 | want int |
| 24 | } { |
| 25 | tests := []struct { |
| 26 | name string |
| 27 | n int |
| 28 | want int |
| 29 | }{ |
| 30 | {"-1 = |1| ", -1, 1}, |
| 31 | {"-255 = |255| ", -255, 255}, |
| 32 | {"0 = |0| ", 0, 0}, |
| 33 | {"5 = |5| ", 5, 5}, |
| 34 | {"-5 = |5| ", -5, 5}, |
| 35 | {"-98368972 = |98368972| ", -98368972, 98368972}, |
| 36 | } |
| 37 | return tests |
| 38 | } |
| 39 | |
| 40 | func BenchmarkSimpleAbs(b *testing.B) { |
| 41 | for i := 0; i < b.N; i++ { |