Libraryless. Click here for Pure Java version (1331L/9K/31K).
1 | !752 |
2 | |
3 | sS suckerID = "#1004698"; |
4 | |
5 | static interface Algorithm { |
6 | S predict(int max); |
7 | void feed(S s); |
8 | } |
9 | |
10 | // simple test algorithm |
11 | sclass TestAlgo implements Algorithm { |
12 | char c; |
13 | public S predict(int max) { ret str(c); } |
14 | public void feed(S s) { c = last(s); } |
15 | } |
16 | |
17 | static O sucker; |
18 | |
19 | p { |
20 | sucker = run(suckerID); |
21 | testAlgo(new TestAlgo); |
22 | } |
23 | |
24 | static void testAlgo(Algorithm algo) { |
25 | ping(); |
26 | |
27 | Class intrface = getClass(sucker, "main$Algorithm"); |
28 | assertNotNull("main$Algorithm", intrface); |
29 | O proxy = proxy(intrface, algo); |
30 | double score = cast call(sucker, "scoreAlgorithm", proxy); |
31 | print("Score for \* algo */: \* formatDouble(score, 3) */"); |
32 | |
33 | S predicted = str(getOpt(sucker, "buf")); |
34 | print("==="); |
35 | print(substring(predicted, 0, 1000)); |
36 | print("==="); |
37 | } |
Began life as a copy of #1004699
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004700 |
Snippet name: | Unit-Test Text Predict Sucker |
Eternal ID of this version: | #1004700/1 |
Text MD5: | 25d1e560028fe6ff6f12a9f92ea80522 |
Transpilation MD5: | 0d505e566df54e205efe2fe420f737a8 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-27 13:16:56 |
Source code size: | 811 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 520 / 595 |
Referenced in: | [show references] |