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

15
LINES

< > BotCompany Repo | #1003071 // runPoemTest1

JavaX fragment (include)

1  
static bool runPoemTest1(L<E> test) {
2  
  int n = 0;
3  
  while (n < l(test) && !test.get(n).test) ++n;
4  
  if (n == l(test)) ret true; // nothing more to test
5  
  L<E> input = subList(test, 0, n);
6  
  L<E> expected = subList(test, n);
7  
  L<E> out = predict(input);
8  
  
9  
  if (l(out) != l(expected)) ret false;
10  
  for (int i = 0; i < l(out); i++)
11  
    if (!out.get(i).eqTo(expected.get(i)))
12  
      ret false;
13  
      
14  
  ret true; // finally - success!
15  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
1217 stefan requires "predict" method 2016-04-27 16:00:08

add comment

Snippet ID: #1003071
Snippet name: runPoemTest1
Eternal ID of this version: #1003071/1
Text MD5: b86ead0fcce896139cb699930c4c20a1
Author: stefan
Category: eleu / nl
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-04-27 16:04:41
Source code size: 448 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 864 / 785
Referenced in: [show references]