Skip to content

Commit be63772

Browse files
committed
Report clean up
1. Included test cases that are approved and removed others 2. Cleaned up report
1 parent cfdae85 commit be63772

File tree

12 files changed

+114
-224
lines changed

12 files changed

+114
-224
lines changed

docs/index.html

Lines changed: 38 additions & 40 deletions
Large diffs are not rendered by default.

java-tests/src/main/java/jsonlogic/Main.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import jsonlogic.test.TestCase;
77
import jsonlogic.reporting.TestSummary;
88

9-
import java.io.File;
10-
import java.nio.file.Files;
119
import java.nio.file.Path;
1210
import java.nio.file.Paths;
1311
import java.util.List;
@@ -53,7 +51,7 @@ public static void main(String[] args) {
5351
private static Map<String, List<TestCase>> loadTestSuites() throws Exception {
5452
ObjectMapper mapper = new ObjectMapper();
5553
Path indexPath = Paths.get("../suites/index.json");
56-
List<String> files = mapper.readValue(indexPath.toFile(), List.class);
54+
List<String> files = mapper.readValue(indexPath.toFile(), new com.fasterxml.jackson.core.type.TypeReference<List<String>>() {});
5755

5856
Map<String, List<TestCase>> suites = new HashMap<>();
5957
Path suitesDir = Paths.get("../suites");

java-tests/src/main/java/jsonlogic/engines/TestRunner.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package jsonlogic.engines;
22

3-
import com.fasterxml.jackson.databind.JsonNode;
43
import com.fasterxml.jackson.databind.ObjectMapper;
54
import io.github.jamsesso.jsonlogic.JsonLogic;
65
import jsonlogic.test.TestCase;
76
import java.util.Map;
8-
import java.util.HashMap;
97

108
public class TestRunner {
119
private final String engine;

reports/report.py

Lines changed: 54 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,25 @@ def create_summary_table(results: Dict[str, Any]) -> Tuple[None, List[List[str]]
6060

6161
# Add test suite rows
6262
for suite in sorted(all_suites):
63-
row = [f"{suite:<30}"] # Left-align suite name with padding
63+
# Get total test cases from first non-empty result
64+
total_cases = 0
65+
for lang, lang_results in results.items():
66+
suite_results = lang_results.get('test_suites', {}).get(suite, {})
67+
for stats in suite_results.values():
68+
total_cases = stats.get('total', 0)
69+
if total_cases > 0:
70+
break
71+
if total_cases > 0:
72+
break
73+
74+
row = [f"{suite} ({total_cases} cases)".ljust(40)] # Left-align suite name with case count
6475
for lang, engines in sorted(engine_by_lang.items()):
6576
for engine in sorted(engines):
6677
suite_results = results[lang].get('test_suites', {}).get(suite, {})
6778
if engine in suite_results:
6879
stats = suite_results[engine]
6980
passed = stats.get('passed', 0)
70-
total = stats.get('total', 0)
71-
row.append(f"{passed:>3}/{total:<3}")
81+
row.append(f"{passed:>3}")
7282
else:
7383
row.append(f"{'N/A':>7}")
7484
rows.append(row)
@@ -88,32 +98,54 @@ def create_summary_table(results: Dict[str, Any]) -> Tuple[None, List[List[str]]
8898
total = stats.get('total', 0)
8999
success_rate = (passed / total * 100) if total > 0 else 0
90100

91-
total_row.append(f"{passed:>3}/{total:<3}")
101+
total_row.append(f"{passed:>3}") # Only show passing tests
92102
success_row.append(f"{success_rate:>6.2f}%")
93103
else:
94104
total_row.append(f"{'N/A':>7}")
95105
success_row.append(f"{'N/A':>7}")
96-
106+
97107
rows.append(total_row)
98108
rows.append(success_row)
99109

100110
return None, rows
101111

102-
def get_success_class(cell: str) -> str:
112+
def get_success_class(cell: str, current_row: list = None) -> str:
103113
if cell.strip() == 'N/A':
104114
return 'na'
105115
try:
106-
if '/' in cell:
107-
passed, total = map(int, cell.split('/'))
108-
rate = (passed / total) * 100
116+
# Skip test suite name cells
117+
if '(' in cell and 'cases)' in cell:
118+
return ''
119+
120+
# Handle percentage values in Success Rate row
121+
if '%' in cell:
122+
rate = float(cell.rstrip('%'))
123+
if rate == 100:
124+
return 'success-high' # Green for 100%
125+
elif rate > 0:
126+
return 'success-medium' # Yellow for partial
127+
return 'success-low' # Amber for 0%
128+
129+
# Handle numeric values in regular cells
130+
value = int(cell.strip())
131+
132+
# If we have the current row and it contains test suite info
133+
if current_row and '(' in current_row[0] and 'cases)' in current_row[0]:
134+
total = int(current_row[0].split('(')[1].split()[0])
135+
rate = (value / total) * 100 if total > 0 else 0
136+
109137
if rate == 100:
110-
return 'success-high'
111-
elif rate >= 50:
112-
return 'success-medium'
113-
return 'success-low'
114-
except:
115-
pass
116-
return ''
138+
return 'success-high' # Green for 100%
139+
elif rate > 0:
140+
return 'success-medium' # Yellow for partial
141+
return 'success-low' # Amber for 0%
142+
143+
# For totals row, only color non-zero values
144+
return 'success-low' if value == 0 else 'success-medium'
145+
146+
except Exception as e:
147+
print(f"Error processing cell '{cell}': {e}")
148+
return ''
117149

118150
def generate_html_report(rows: list, results: Dict[str, Any]) -> str:
119151
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@@ -159,10 +191,10 @@ def generate_html_report(rows: list, results: Dict[str, Any]) -> str:
159191
vertical-align: middle;
160192
margin-left: 4px;
161193
}}
162-
.success-high {{ background-color: #90EE90; }} /* Light green */
163-
.success-medium {{ background-color: #FFD700; }} /* Yellow */
164-
.success-low {{ background-color: #FFA07A; }} /* Light salmon */
165-
.na {{ background-color: #f2f2f2; }} /* Light gray */
194+
.success-high {{ background-color: #98FB98; }} /* Pale green for 100% */
195+
.success-medium {{ background-color: #FFD700; }} /* Gold for partial */
196+
.success-low {{ background-color: #FF8C00; }} /* Dark orange for 0% */
197+
.na {{ background-color: #f2f2f2; }} /* Light gray for N/A */
166198
</style>
167199
<link rel="stylesheet" type='text/css' href="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/devicon.min.css" />
168200
</head>
@@ -196,7 +228,7 @@ def generate_html_report(rows: list, results: Dict[str, Any]) -> str:
196228
if i == 0:
197229
html += f"<td class='left'>{cell}</td>"
198230
else:
199-
success_class = get_success_class(cell)
231+
success_class = get_success_class(cell, row)
200232
html += f"<td class='{success_class}'>{cell}</td>"
201233
html += "</tr>\n"
202234

@@ -208,7 +240,7 @@ def generate_html_report(rows: list, results: Dict[str, Any]) -> str:
208240
if i == 0:
209241
html += f"<td class='left'>{cell}</td>"
210242
else:
211-
success_class = get_success_class(cell)
243+
success_class = get_success_class(cell, row)
212244
html += f"<td class='{success_class}'>{cell}</td>"
213245
html += "</tr>\n"
214246

results/csharp.json

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,6 @@
147147
"success_rate": 90.9090909090909
148148
}
149149
},
150-
"control/or.json": {
151-
"jsonlogicnet": {
152-
"total": 0,
153-
"passed": 0,
154-
"success_rate": 0.0
155-
}
156-
},
157150
"truthiness.json": {
158151
"jsonlogicnet": {
159152
"total": 13,
@@ -196,13 +189,6 @@
196189
"success_rate": 0.0
197190
}
198191
},
199-
"scopes.json": {
200-
"jsonlogicnet": {
201-
"total": 4,
202-
"passed": 0,
203-
"success_rate": 0.0
204-
}
205-
},
206192
"throw.json": {
207193
"jsonlogicnet": {
208194
"total": 3,
@@ -234,10 +220,10 @@
234220
},
235221
"totals": {
236222
"jsonlogicnet": {
237-
"total": 942,
223+
"total": 938,
238224
"passed": 592,
239-
"success_rate": 62.84501061571125
225+
"success_rate": 63.11300639658849
240226
}
241227
},
242-
"timestamp": "2025-02-16T04:36:30.358208Z"
228+
"timestamp": "2025-02-20T03:57:34.245416Z"
243229
}

results/go.json

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,6 @@
240240
"total": 44
241241
}
242242
},
243-
"control/or.json": {
244-
"DiegoHOliveira": {
245-
"passed": 0,
246-
"total": 0
247-
},
248-
"HuanTeng": {
249-
"passed": 0,
250-
"total": 0
251-
}
252-
},
253243
"exists.json": {
254244
"DiegoHOliveira": {
255245
"passed": 4,
@@ -270,16 +260,6 @@
270260
"total": 34
271261
}
272262
},
273-
"scopes.json": {
274-
"DiegoHOliveira": {
275-
"passed": 0,
276-
"total": 4
277-
},
278-
"HuanTeng": {
279-
"passed": 0,
280-
"total": 4
281-
}
282-
},
283263
"throw.json": {
284264
"DiegoHOliveira": {
285265
"passed": 0,
@@ -334,13 +314,13 @@
334314
"totals": {
335315
"DiegoHOliveira": {
336316
"passed": 626,
337-
"total": 942
317+
"total": 938
338318
},
339319
"HuanTeng": {
340320
"passed": 424,
341-
"total": 942
321+
"total": 938
342322
}
343323
},
344-
"timestamp": "2025-02-16T04:36:23Z",
324+
"timestamp": "2025-02-20T03:57:28Z",
345325
"go_version": "go1.23.0"
346326
}

results/java.json

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@
3535
"success_rate" : 64.44444444444444
3636
}
3737
},
38-
"scopes.json" : {
39-
"jamsesso" : {
40-
"total" : 4,
41-
"passed" : 0,
42-
"success_rate" : 0.0
43-
}
44-
},
4538
"throw.json" : {
4639
"jamsesso" : {
4740
"total" : 3,
@@ -147,13 +140,6 @@
147140
"success_rate" : 94.24460431654676
148141
}
149142
},
150-
"control/or.json" : {
151-
"jamsesso" : {
152-
"total" : 0,
153-
"passed" : 0,
154-
"success_rate" : 0.0
155-
}
156-
},
157143
"comparison/greaterThan.json" : {
158144
"jamsesso" : {
159145
"total" : 35,
@@ -234,10 +220,10 @@
234220
},
235221
"totals" : {
236222
"jamsesso" : {
237-
"total" : 942,
223+
"total" : 938,
238224
"passed" : 545,
239-
"success_rate" : 57.85562632696391
225+
"success_rate" : 58.10234541577825
240226
}
241227
},
242-
"timestamp" : "2025-02-16T04:36:29.016733Z"
228+
"timestamp" : "2025-02-20T03:57:33.324224Z"
243229
}

results/javascript.json

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -252,18 +252,6 @@
252252
"success_rate": 100
253253
}
254254
},
255-
"control/or.json": {
256-
"json-logic-js": {
257-
"passed": 0,
258-
"total": 0,
259-
"success_rate": 0
260-
},
261-
"json-logic-engine": {
262-
"passed": 0,
263-
"total": 0,
264-
"success_rate": 0
265-
}
266-
},
267255
"truthiness.json": {
268256
"json-logic-js": {
269257
"passed": 9,
@@ -336,18 +324,6 @@
336324
"success_rate": 100
337325
}
338326
},
339-
"scopes.json": {
340-
"json-logic-js": {
341-
"passed": 0,
342-
"total": 4,
343-
"success_rate": 0
344-
},
345-
"json-logic-engine": {
346-
"passed": 4,
347-
"total": 4,
348-
"success_rate": 100
349-
}
350-
},
351327
"throw.json": {
352328
"json-logic-js": {
353329
"passed": 0,
@@ -400,14 +376,14 @@
400376
"totals": {
401377
"json-logic-js": {
402378
"passed": 603,
403-
"total": 942,
404-
"success_rate": 64.01273885350318
379+
"total": 938,
380+
"success_rate": 64.28571428571429
405381
},
406382
"json-logic-engine": {
407-
"passed": 942,
408-
"total": 942,
383+
"passed": 938,
384+
"total": 938,
409385
"success_rate": 100
410386
}
411387
},
412-
"timestamp": "2025-02-16T04:36:22.244Z"
388+
"timestamp": "2025-02-20T03:57:28.315Z"
413389
}

results/php.json

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,6 @@
147147
"success_rate": 90.9090909090909
148148
}
149149
},
150-
"control\/or.json": {
151-
"jwadhams": {
152-
"passed": 0,
153-
"total": 0,
154-
"success_rate": 0
155-
}
156-
},
157150
"truthiness.json": {
158151
"jwadhams": {
159152
"passed": 8,
@@ -196,13 +189,6 @@
196189
"success_rate": 0
197190
}
198191
},
199-
"scopes.json": {
200-
"jwadhams": {
201-
"passed": 0,
202-
"total": 4,
203-
"success_rate": 0
204-
}
205-
},
206192
"throw.json": {
207193
"jwadhams": {
208194
"passed": 0,
@@ -235,8 +221,8 @@
235221
"totals": {
236222
"jwadhams": {
237223
"passed": 617,
238-
"total": 942,
239-
"success_rate": 65.49893842887474
224+
"total": 938,
225+
"success_rate": 65.77825159914713
240226
}
241227
}
242228
}

0 commit comments

Comments
 (0)