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

9
LINES

< > BotCompany Repo | #1035785 // test_CutListToBudget (OK)

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

Libraryless. Click here for Pure Java version (9785L/54K).

1  
svoid test_CutListToBudget() {
2  
  var cutter = new CutListToBudget<S>(s -> (double) l(s));
3  
  cutter.allowPartial((s, l) -> takeFirst(s, iround(l)));
4  
  cutter.maxPrice(3);
5  
  cutter.inputList(ll("aaaaa"));
6  
  assertEqualsVerbose(ll("aaa"), cutter!);
7  
  assertEqualsVerbose("aaaaa", cutter.fullLastElement());
8  
  assertEqualsVerbose(Percent.fromRatio(3.0/5.0), cutter.lastElementKeptPercentage());
9  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035785
Snippet name: test_CutListToBudget (OK)
Eternal ID of this version: #1035785/6
Text MD5: f49702ee88d5af3a643f41ffaac8c634
Transpilation MD5: 27de717f617e074d6c95c8fb291c1c40
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-07-25 15:59:35
Source code size: 400 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 132 / 206
Version history: 5 change(s)
Referenced in: [show references]