Libraryless. Click here for Pure Java version (2467L/16K).
1 | svoid test_pixelSpiral() { |
2 | int maxW = 10, maxH = maxW; |
3 | for (int w = 1; w <= maxW; w++) |
4 | for (int h = 1; h <= maxH; h++) { |
5 | print("Testing " + w + "*" + h); |
6 | Set<Pt> allPoints = asSet(allPointsInRect(w, h)); |
7 | |
8 | for x to w: for y to h: { |
9 | print(" " + x + "/" + y); |
10 | L<Pt> l = asList(pixelSpiral(x, y, w, h)); |
11 | assertEquals(l(l), w*h); |
12 | assertEquals(asSet(l), allPoints); |
13 | assertEquals(first(l), pt(x, y)); |
14 | // We trust the remaining points are in the correct order |
15 | } |
16 | } |
17 | |
18 | print("pixelSpiral (probably) OK up to " + maxW + "*" + maxH); |
19 | } |
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: | 201 / 314 |
Version history: | 6 change(s) |
Referenced in: | [show references] |