Libraryless. Click here for Pure Java version (2467L/16K).
svoid test_pixelSpiral() { int maxW = 10, maxH = maxW; for (int w = 1; w <= maxW; w++) for (int h = 1; h <= maxH; h++) { print("Testing " + w + "*" + h); Set<Pt> allPoints = asSet(allPointsInRect(w, h)); for x to w: for y to h: { print(" " + x + "/" + y); L<Pt> l = asList(pixelSpiral(x, y, w, h)); assertEquals(l(l), w*h); assertEquals(asSet(l), allPoints); assertEquals(first(l), pt(x, y)); // We trust the remaining points are in the correct order } } print("pixelSpiral (probably) OK up to " + maxW + "*" + maxH); }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1025247 |
| Snippet name: | test_pixelSpiral |
| Eternal ID of this version: | #1025247/7 |
| Text MD5: | a6d9adfaf2f1fa7c4ecb4850eba99e68 |
| Transpilation MD5: | 0705c5b4c5b7d3e1246d02053a0a0f84 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-09-15 16:34:08 |
| Source code size: | 630 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 420 / 577 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |