diffing in go tests
I was fiddling around, implementing Salsa20 in Go, and it's almost entirely just a huge series of simple array fiddles. So, not too hard to implement, and easy to test since DJB provides test vectors for the subcomponents of the algorithm in the paper. Of course, go's default test failure output is a bit...terse:
main_test.go:417: salsa_expansion_from_32() = [253 186 245 170 147 194 183 194 67 168 157 152 41 61 146 146 156 147 131 144 213 198 196 36 176 87 85 13 70 89 101 111 22 59 13 201 68 140 157 2 39 194 35 104 15 154 88 184 17 234 28 83 57 220 29 110 69 165 248 105 155 246 252 168], want [69 37 68 39 41 15 107 193 255 139 122 6 170 233 217 98 89 144 182 106 21 51 200 65 239 49 222 34 215 114 40 126 104 197 7 225 197 153 31 2 102 78 76 176 84 245 246 184 177 160 133 130 6 72 149 119 192 195 132 236 234 103 246 74]
testify's is a fair bit more useful:
Diff:
--- Expected
+++ Actual
@@ -1,6 +1,6 @@
([64]uint8) (len=64) {
- 00000000 45 25 44 27 29 0f 6b c1 ff 8b 7a 06 aa e9 d9 62 |E%D').k...z....b|
- 00000010 59 90 b6 6a 15 33 c8 41 ef 31 de 22 d7 72 28 7e |Y..j.3.A.1.".r(~|
- 00000020 68 c5 07 e1 c5 99 1f 02 66 4e 4c b0 54 f5 f6 b8 |h.......fNL.T...|
- 00000030 b1 a0 85 82 06 48 95 77 c0 c3 84 ec ea 67 f6 4a |.....H.w.....g.J|
+ 00000000 fd ba f5 aa 93 c2 b7 c2 43 a8 9d 98 29 3d 92 92 |........C...)=..|
+ 00000010 9c 93 83 90 d5 c6 c4 24 b0 57 55 0d 46 59 65 6f |.......$.WU.FYeo|
+ 00000020 16 3b 0d c9 44 8c 9d 02 27 c2 23 68 0f 9a 58 b8 |.;..D...'.#h..X.|
+ 00000030 11 ea 1c 53 39 dc 1d 6e 45 a5 f8 69 9b f6 fc a8 |...S9..nE..i....|
}