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).

svoid test_structure_multiDimensionalIntArrays() {
  int[] a = new { 3, 10, -5 };
  
  assertEqualsVerbose("intarray{3, 10, -5}", struct(a));
  assertEqualsVerbose(ll(3, 10, -5), toList(restruct(a)));
  
  int[] b = new { 4 };
  int[][] c = { a, b };
  
  assertEqualsVerbose("intarray/2{intarray{3, 10, -5}, intarray{4}}", struct(c));
  int[][] c2 = restruct(c); // check the actual type
  assertEqualsVerbose(ll(ll(3, 10, -5), ll(4)), lmap toList(toList(c2)));
  
  // test 3rd dimension
  int[][][] d = { c };
  
  assertEqualsVerbose("intarray/3{intarray/2{intarray{3, 10, -5}, intarray{4}}}", struct(d));
  int[][][] d2 = restruct(d); // check the actual type
  assertEqualsVerbose(ll(ll(ll(3, 10, -5), ll(4))),
    lmap(l -> lmap toList(l), d2));
}

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: 192 / 288
Version history: 10 change(s)
Referenced in: [show references]