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

15
LINES

< > BotCompany Repo | #1003071 // runPoemTest1

JavaX fragment (include)

static bool runPoemTest1(L<E> test) {
  int n = 0;
  while (n < l(test) && !test.get(n).test) ++n;
  if (n == l(test)) ret true; // nothing more to test
  L<E> input = subList(test, 0, n);
  L<E> expected = subList(test, n);
  L<E> out = predict(input);
  
  if (l(out) != l(expected)) ret false;
  for (int i = 0; i < l(out); i++)
    if (!out.get(i).eqTo(expected.get(i)))
      ret false;
      
  ret true; // finally - success!
}

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: 953 / 873
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)