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

17
LINES

< > BotCompany Repo | #1036456 // test_MountainsAndValleys (OK)

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

Libraryless. Click here for Pure Java version (10285L/57K).

svoid test_MountainsAndValleys {
  new MountainsAndValleys mav;
  mav.values(litdoublearray(1, 5, 3, 4, 5, 5, 2));
  mav.run();
  assertEqualsVerbose(ll(1, 4), mav.highs().asList());
  assertEqualsVerbose(ll(0, 2, 6), mav.lows().asList());
  
  assertEqualsVerbose(1, mav.next(mav.highs, 0));
  assertEqualsVerbose(4, mav.next(mav.highs, 01);
  assertEqualsVerbose(-1, mav.next(mav.highs, 4));
  
  assertEqualsVerbose(-1, mav.prev(mav.lows, 0));
  assertEqualsVerbose(0, mav.prev(mav.lows, 1));
  assertEqualsVerbose(0, mav.prev(mav.lows, 2));
  assertEqualsVerbose(2, mav.prev(mav.lows, 3));
  assertEqualsVerbose(2, mav.prev(mav.lows, 4));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): mowyntqkapby, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036456
Snippet name: test_MountainsAndValleys (OK)
Eternal ID of this version: #1036456/4
Text MD5: acdbc8ff89a697eaa262175da5397488
Transpilation MD5: 7d86fbaacf993a2bb3f27b541d9a7dbd
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-15 22:39:14
Source code size: 660 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 148 / 209
Version history: 3 change(s)
Referenced in: [show references]