Skip to content

Commit

Permalink
bumped html-report identical test to include a zero run #190
Browse files Browse the repository at this point in the history
  • Loading branch information
daveshanley committed Dec 7, 2022
1 parent 0c306d0 commit 8479b8f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion benchmarks/html_report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func BenchmarkHtmlReport_GenerateReportIdentical(b *testing.B) {
}
}

func TestHtmlReport_GenerateReportIdenticalRun100(t *testing.T) {
func TestHtmlReport_GenerateReportIdenticalRun200(t *testing.T) {
specBytes, _ := os.ReadFile("../model/test_files/pegel-online-api.yaml")
defaultRuleSets := rulesets.BuildDefaultRuleSets()

Expand All @@ -92,6 +92,10 @@ func TestHtmlReport_GenerateReportIdenticalRun100(t *testing.T) {
// generate statistics
stats := statistics.CreateReportStatistics(ruleset.Index, ruleset.SpecInfo, resultSet)

reportZero := html_report.NewHTMLReport(ruleset.Index, ruleset.SpecInfo, resultSet, stats, true)
reportZeroBytes := reportZero.GenerateReport(false)
hashZero := sha256.Sum256(reportZeroBytes)

for n := 0; n < 200; n++ {
// generate html reports and compare hash
reportA := html_report.NewHTMLReport(ruleset.Index, ruleset.SpecInfo, resultSet, stats, true)
Expand All @@ -107,5 +111,13 @@ func TestHtmlReport_GenerateReportIdenticalRun100(t *testing.T) {
panic("failed identical check")
}

if hashA != hashZero {
panic("failed identical check")
}

if hashB != hashZero {
panic("failed identical check")
}

}
}

0 comments on commit 8479b8f

Please sign in to comment.