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

30
LINES

< > BotCompany Repo | #1029104 // test_LCSingleSearcher_v1_systematically

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

Uses 11335K of libraries. Click here for Pure Java version (9485L/61K).

1  
svoid test_LCSingleSearcher_v1_systematically(int max, O... _) {
2  
  optPar bool verbose;
3  
  optPar bool checkOverlongQueries = true;
4  
  
5  
  for (int n = 0; n <= max; n++) {
6  
    print("Testing length " + n);
7  
    int tests = 0;
8  
    for (S text : allABCCombinationsOfLength(n)) {
9  
      //print(+text);
10  
      for (int j = 1; j <= n+(checkOverlongQueries ? 1 : 0); j++)
11  
        for (S query : allABCCombinationsOfLength(j)) {
12  
          ++tests;
13  
          Pair<L<Int>, S> output = hijackPrintWithResult(() -> {
14  
            new LCSingleSearcher_v1 searcher;
15  
            searcher.text = text;
16  
            ret searcher.search(query);
17  
          });
18  
          L<Int> correct = indicesOf(text, query);
19  
          L<Int> out = sorted(output.a);
20  
          if (eq(correct, out)) {
21  
            if (verbose) print("OK " + query + " in " + text + ": " + out);
22  
          } else {
23  
            print(output);
24  
            fail(query + " in " + text + ": " + out + " / " + correct);
25  
          }
26  
        }
27  
    }
28  
    print(nTests(tests) + " done");
29  
  }
30  
}

Author comment

Began life as a copy of #1029101

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1029104
Snippet name: test_LCSingleSearcher_v1_systematically
Eternal ID of this version: #1029104/11
Text MD5: 8a6ebbc419cec66c5d6a8b356eb335b7
Transpilation MD5: 427f332dc85f6f1a3ff7a39c3f45d6a9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-20 13:11:40
Source code size: 1053 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 165 / 251
Version history: 10 change(s)
Referenced in: [show references]