Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1031244 // test_structure_multiDimensionalIntArrays

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (6245L/38K).

1  
svoid test_structure_multiDimensionalIntArrays() {
2  
  int[] a = new { 3, 10, -5 };
3  
  
4  
  assertEqualsVerbose("intarray{3, 10, -5}", struct(a));
5  
  assertEqualsVerbose(ll(3, 10, -5), toList(restruct(a)));
6  
  
7  
  int[] b = new { 4 };
8  
  int[][] c = { a, b };
9  
  
10  
  assertEqualsVerbose("intarray/2{intarray{3, 10, -5}, intarray{4}}", struct(c));
11  
  int[][] c2 = restruct(c); // check the actual type
12  
  assertEqualsVerbose(ll(ll(3, 10, -5), ll(4)), lmap toList(toList(c2)));
13  
  
14  
  // test 3rd dimension
15  
  int[][][] d = { c };
16  
  
17  
  assertEqualsVerbose("intarray/3{intarray/2{intarray{3, 10, -5}, intarray{4}}}", struct(d));
18  
  int[][][] d2 = restruct(d); // check the actual type
19  
  assertEqualsVerbose(ll(ll(ll(3, 10, -5), ll(4))),
20  
    lmap(l -> lmap toList(l), d2));
21  
}

Author comment

Began life as a copy of #1024875

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031244
Snippet name: test_structure_multiDimensionalIntArrays
Eternal ID of this version: #1031244/11
Text MD5: 415d3d082e3004217505ef9ee93dfd87
Transpilation MD5: 465f2e0669ad33be7edd11b771f5e91b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-25 18:03:11
Source code size: 774 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 116 / 200
Version history: 10 change(s)
Referenced in: [show references]