Skip to content

Commit

Permalink
encoding/jsonschema: show optional test stats separately
Browse files Browse the repository at this point in the history
There are a bunch of "optional" tests in the test suite, quite a few of
which we will never implement support for.

Show stats for those tests separately so it's clear how many of the
non-optional tests are passing/failing.

Signed-off-by: Roger Peppe <[email protected]>
Change-Id: I477295ffff2fdb4dcef443073095840e6abe1d2b
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1201126
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
  • Loading branch information
rogpeppe committed Sep 12, 2024
1 parent 6f4cd7b commit a227239
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
24 changes: 18 additions & 6 deletions encoding/jsonschema/external_teststats.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
# Generated by teststats. DO NOT EDIT
v2:
schema extract (pass / total): 1077 / 1637 = 65.8%
tests (pass / total): 3467 / 7175 = 48.3%
tests on extracted schemas (pass / total): 3467 / 3884 = 89.3%
schema extract (pass / total): 923 / 1363 = 67.7%
tests (pass / total): 3076 / 4803 = 64.0%
tests on extracted schemas (pass / total): 3076 / 3362 = 91.5%

v3:
schema extract (pass / total): 1065 / 1637 = 65.1%
tests (pass / total): 3418 / 7175 = 47.6%
tests on extracted schemas (pass / total): 3418 / 3840 = 89.0%
schema extract (pass / total): 911 / 1363 = 66.8%
tests (pass / total): 3037 / 4803 = 63.2%
tests on extracted schemas (pass / total): 3037 / 3318 = 91.5%

Optional tests

v2:
schema extract (pass / total): 154 / 274 = 56.2%
tests (pass / total): 391 / 2372 = 16.5%
tests on extracted schemas (pass / total): 391 / 522 = 74.9%

v3:
schema extract (pass / total): 154 / 274 = 56.2%
tests (pass / total): 381 / 2372 = 16.1%
tests on extracted schemas (pass / total): 381 / 522 = 73.0%
19 changes: 15 additions & 4 deletions encoding/jsonschema/teststats.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"os"
"path"
"sort"
"strings"

"cuelang.org/go/cue/token"
"cuelang.org/go/encoding/jsonschema/internal/externaltest"
Expand Down Expand Up @@ -56,21 +57,31 @@ func main() {
listFailures(outw, *list, tests)
} else {
fmt.Fprintf(outw, "v2:\n")
showStats(outw, "v2", tests)
showStats(outw, "v2", false, tests)
fmt.Fprintf(outw, "\n")
fmt.Fprintf(outw, "v3:\n")
showStats(outw, "v3", tests)
showStats(outw, "v3", false, tests)
fmt.Fprintf(outw, "\nOptional tests\n\n")
fmt.Fprintf(outw, "v2:\n")
showStats(outw, "v2", true, tests)
fmt.Fprintf(outw, "\n")
fmt.Fprintf(outw, "v3:\n")
showStats(outw, "v3", true, tests)
}
}

func showStats(outw io.Writer, version string, tests map[string][]*externaltest.Schema) {
func showStats(outw io.Writer, version string, showOptional bool, tests map[string][]*externaltest.Schema) {
schemaOK := 0
schemaTot := 0
testOK := 0
testTot := 0
schemaOKTestOK := 0
schemaOKTestTot := 0
for _, schemas := range tests {
for filename, schemas := range tests {
isOptional := strings.Contains(filename, "/optional/")
if isOptional != showOptional {
continue
}
for _, schema := range schemas {
schemaTot++
if schema.Skip[version] == "" {
Expand Down

0 comments on commit a227239

Please sign in to comment.