github.com/koko1123/flow-go-1@v0.29.6/tools/test_monitor/common/testdata/test_data.go (about) 1 package testdata 2 3 import ( 4 "time" 5 6 "github.com/koko1123/flow-go-1/tools/test_monitor/common" 7 ) 8 9 const COMMIT_DATE = "2021-09-21T18:06:25-07:00" 10 const COMMIT_SHA = "46baf6c6be29af9c040bc14195e195848598bbae" 11 const JOB_STARTED = "2021-09-21T21:06:25-07:00" 12 const CRYPTO_HASH_PACKAGE = "github.com/onflow/flow-go/crypto/hash" 13 const RUN_ID = "12345" 14 15 // Level1TestData is used by tests to store what the expected test result should be and what the raw 16 // JSON input file is 17 type Level1TestData struct { 18 ExpectedLevel1Summary common.Level1Summary 19 RawJSONTestRunFile string 20 } 21 22 type Level2TestData struct { 23 Directory string 24 Level1DataPath string 25 HasFailures bool 26 HasExceptions bool 27 Level1Summaries []common.Level1Summary 28 } 29 30 // ************** Helper Functions ***************** 31 // following functions are used to construct expected TestRun data 32 33 func getCommitDate() time.Time { 34 commitDate, err := time.Parse(time.RFC3339, COMMIT_DATE) 35 common.AssertNoError(err, "time parse - commit date") 36 return commitDate 37 } 38 39 func getJobRunDate() time.Time { 40 jobRunDate, err := time.Parse(time.RFC3339, JOB_STARTED) 41 common.AssertNoError(err, "time parse - job run date") 42 return jobRunDate 43 } 44 45 func getPassedTest(name string) common.Level1TestResult { 46 return getPassedTestPackage(name, CRYPTO_HASH_PACKAGE) 47 } 48 49 func getPassedTestPackage(name string, packageName string) common.Level1TestResult { 50 return common.Level1TestResult{ 51 CommitSha: COMMIT_SHA, 52 RunID: RUN_ID, 53 CommitDate: getCommitDate(), 54 JobRunDate: getJobRunDate(), 55 Test: name, 56 Package: packageName, 57 Pass: 1, 58 Exception: 0, 59 Elapsed: 0, 60 } 61 } 62 63 func getPassedTestElapsed(name string, elapsed float64, elapsedStr string) common.Level1TestResult { 64 return common.Level1TestResult{ 65 CommitSha: COMMIT_SHA, 66 RunID: RUN_ID, 67 CommitDate: getCommitDate(), 68 JobRunDate: getJobRunDate(), 69 Test: name, 70 Package: CRYPTO_HASH_PACKAGE, 71 Pass: 1, 72 Exception: 0, 73 Elapsed: elapsed, 74 } 75 } 76 77 func getPassedTestPackageElapsedOutput(name string, packageName string, elapsed float64, elapsedStr string, output string) common.Level1TestResult { 78 row := getPassedTestElapsedOutput(name, elapsed, elapsedStr, output) 79 row.Package = packageName 80 return row 81 } 82 83 func getPassedTestElapsedOutput(name string, elapsed float64, elapsedStr string, output string) common.Level1TestResult { 84 return common.Level1TestResult{ 85 CommitSha: COMMIT_SHA, 86 RunID: RUN_ID, 87 CommitDate: getCommitDate(), 88 JobRunDate: getJobRunDate(), 89 Test: name, 90 Package: CRYPTO_HASH_PACKAGE, 91 Pass: 1, 92 Exception: 0, 93 Elapsed: elapsed, 94 } 95 } 96 97 func getFailedTest_TestSanitySha2_256() common.Level1TestResult { 98 return common.Level1TestResult{ 99 CommitSha: COMMIT_SHA, 100 RunID: RUN_ID, 101 CommitDate: getCommitDate(), 102 JobRunDate: getJobRunDate(), 103 Test: "TestSanitySha2_256", 104 Package: CRYPTO_HASH_PACKAGE, 105 Pass: 0, 106 Exception: 0, 107 Elapsed: 0, 108 Output: []string{ 109 "=== RUN TestSanitySha2_256\n", 110 " hash_test.go:41: \n", 111 " \tError Trace:\thash_test.go:41\n", 112 " \tError: \tNot equal: \n", 113 " \t \texpected: hash.Hash{0x9f, 0x86, 0xd0, 0x81, 0x88, 0x4c, 0x7d, 0x65, 0x9a, 0x2f, 0xea, 0xa0, 0xc5, 0x5a, 0xd0, 0x15, 0xa3, 0xbf, 0x4f, 0x1b, 0x2b, 0xb, 0x82, 0x2c, 0xd1, 0x5d, 0x6c, 0x15, 0xb0, 0xf0, 0xa, 0x9}\n", 114 " \t \tactual : hash.Hash{0x9f, 0x86, 0xd0, 0x81, 0x88, 0x4c, 0x7d, 0x65, 0x9a, 0x2f, 0xea, 0xa0, 0xc5, 0x5a, 0xd0, 0x15, 0xa3, 0xbf, 0x4f, 0x1b, 0x2b, 0xb, 0x82, 0x2c, 0xd1, 0x5d, 0x6c, 0x15, 0xb0, 0xf0, 0xa, 0x8}\n", 115 " \t \t\n", 116 " \t \tDiff:\n", 117 " \t \t--- Expected\n", 118 " \t \t+++ Actual\n", 119 " \t \t@@ -1,2 +1,2 @@\n", 120 " \t \t-(hash.Hash) (len=32) 0x9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a09\n", 121 " \t \t+(hash.Hash) (len=32) 0x9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08\n", 122 " \t \t \n", 123 " \tTest: \tTestSanitySha2_256\n", 124 "--- FAIL: TestSanitySha2_256 (0.00s)\n", 125 }, 126 } 127 } 128 129 func getFailedTest_TestSanitySha3_256() common.Level1TestResult { 130 return common.Level1TestResult{ 131 CommitSha: COMMIT_SHA, 132 RunID: RUN_ID, 133 CommitDate: getCommitDate(), 134 JobRunDate: getJobRunDate(), 135 Test: "TestSanitySha3_256", 136 Package: CRYPTO_HASH_PACKAGE, 137 Pass: 0, 138 Exception: 0, 139 Elapsed: 0, 140 Output: []string{ 141 "=== RUN TestSanitySha3_256\n", 142 " hash_test.go:21: \n", 143 " \tError Trace:\thash_test.go:21\n", 144 " \tError: \tNot equal: \n", 145 " \t \texpected: hash.Hash{0x36, 0xf0, 0x28, 0x58, 0xb, 0xb0, 0x2c, 0xc8, 0x27, 0x2a, 0x9a, 0x2, 0xf, 0x42, 0x0, 0xe3, 0x46, 0xe2, 0x76, 0xae, 0x66, 0x4e, 0x45, 0xee, 0x80, 0x74, 0x55, 0x74, 0xe2, 0xf5, 0xab, 0x81}\n", 146 " \t \tactual : hash.Hash{0x36, 0xf0, 0x28, 0x58, 0xb, 0xb0, 0x2c, 0xc8, 0x27, 0x2a, 0x9a, 0x2, 0xf, 0x42, 0x0, 0xe3, 0x46, 0xe2, 0x76, 0xae, 0x66, 0x4e, 0x45, 0xee, 0x80, 0x74, 0x55, 0x74, 0xe2, 0xf5, 0xab, 0x80}\n", 147 " \t \t\n", 148 " \t \tDiff:\n", 149 " \t \t--- Expected\n", 150 " \t \t+++ Actual\n", 151 " \t \t@@ -1,2 +1,2 @@\n", 152 " \t \t-(hash.Hash) (len=32) 0x36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab81\n", 153 " \t \t+(hash.Hash) (len=32) 0x36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80\n", 154 " \t \t \n", 155 " \tTest: \tTestSanitySha3_256\n", 156 "--- FAIL: TestSanitySha3_256 (0.00s)\n", 157 }, 158 } 159 } 160 161 func getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack() common.Level1TestResult { 162 return common.Level1TestResult{ 163 CommitSha: COMMIT_SHA, 164 RunID: RUN_ID, 165 CommitDate: getCommitDate(), 166 JobRunDate: getJobRunDate(), 167 Test: "TestEncodableRandomBeaconPrivKeyMsgPack", 168 Package: "github.com/koko1123/flow-go-1/model/encodable", 169 Pass: 0, 170 Exception: 1, 171 Elapsed: 0, 172 Output: []string{ 173 "=== RUN TestEncodableRandomBeaconPrivKeyMsgPack\n", 174 "bytes: 194--- PASS: TestEncodableRandomBeaconPrivKeyMsgPack (0.00s)\n", 175 }, 176 } 177 } 178 179 // ********************************************************** 180 // ************** Level 1 Summaries Testing ***************** 181 // ********************************************************** 182 183 // The following GetTestData_Level1_*() functions are used by level 1 unit tests for constructing expected level 1 summaries. 184 // These expected level 1 summaries will be compared with the generated level 1 summaries created by the level 1 parser. 185 // Instead of having to represent these level 1 summaries as JSON files, they are represented as structs 186 // to make them easier to maintain. 187 188 // GetTestData_Level1_1CountSingleExceptionTest represents a level 1 summary (as exptected output from level 1 parser) 189 // with a single no result test and no other tests, count=1. 190 func GetTestData_Level1_1CountSingleExceptionTest() common.Level1Summary { 191 return []common.Level1TestResult{ 192 getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack(), 193 } 194 } 195 196 // GetTestData_Level1_1CountPass represents a level 1 summary (as exptected output from level 1 parser) 197 // with multiple passed tests, count=1. 198 func GetTestData_Level1_1CountPass() common.Level1Summary { 199 return []common.Level1TestResult{ 200 getPassedTest("TestSanitySha3_256"), 201 getPassedTest("TestSanitySha2_256"), 202 getPassedTest("TestSanitySha3_384"), 203 getPassedTest("TestSanitySha2_384"), 204 getPassedTest("TestSanityKmac128"), 205 getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632497249121800000\n"), 206 getPassedTestElapsedOutput("TestSha3", 0.23, "0.23", " hash_test.go:158: math rand seed is 1632497249122032000\n"), 207 getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10"), 208 getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12"), 209 } 210 } 211 212 // GetTestData_Level1_1Count1FailRestPass represents a level 1 summary (as exptected output from level 1 parser) 213 // with multiple passed tests and a single failed test, count=1. 214 func GetTestData_Level1_1Count1FailRestPass() common.Level1Summary { 215 return []common.Level1TestResult{ 216 getFailedTest_TestSanitySha3_256(), 217 getPassedTest("TestSanitySha3_384"), 218 getPassedTest("TestSanitySha2_256"), 219 getPassedTest("TestSanitySha2_384"), 220 getPassedTest("TestSanityKmac128"), 221 getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632498687765218000\n"), 222 getPassedTestElapsedOutput("TestSha3", 0.23, "0.23", " hash_test.go:158: math rand seed is 1632498687765661000\n"), 223 getPassedTestElapsed("TestSha3/SHA3_256", 0.11, "0.11"), 224 getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12"), 225 } 226 } 227 228 // GetTestData_Level1_1CountAllPass represents a level 1 summary (as exptected output from level 1 parser) 229 // with multiple passed tests, count=1. 230 func GetTestData_Level1_1CountAllPass() common.Level1Summary { 231 return []common.Level1TestResult{ 232 getPassedTest("TestSanitySha3_256"), 233 getPassedTest("TestSanitySha3_384"), 234 getPassedTest("TestSanitySha2_384"), 235 getPassedTest("TestSanityKmac128"), 236 getPassedTestElapsedOutput("TestSha3", 0.24, "0.24", " hash_test.go:160: math rand seed is 1633518697589650000\n"), 237 getPassedTestElapsed("TestSha3/SHA3_256", 0.11, "0.11"), 238 getPassedTestElapsed("TestSha3/SHA3_384", 0.13, "0.13"), 239 } 240 } 241 242 // GetTestData_Level1_2CountPass represents a level 1 summary (as exptected output from level 1 parser) 243 // with multiple passed tests, count=2. 244 func GetTestData_Level1_2CountPass() common.Level1Summary { 245 var level1TestResults []common.Level1TestResult 246 for i := 0; i < 2; i++ { 247 level1TestResults = append(level1TestResults, getPassedTest("TestSanitySha3_256")) 248 level1TestResults = append(level1TestResults, getPassedTest("TestSanitySha2_256")) 249 level1TestResults = append(level1TestResults, getPassedTest("TestSanitySha3_384")) 250 level1TestResults = append(level1TestResults, getPassedTest("TestSanitySha2_384")) 251 level1TestResults = append(level1TestResults, getPassedTest("TestSanityKmac128")) 252 level1TestResults = append(level1TestResults, getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10")) 253 level1TestResults = append(level1TestResults, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 254 } 255 256 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1633358050203144000\n")) 257 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1633358050430256000\n")) 258 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.23, "0.23", " hash_test.go:158: math rand seed is 1633358050203374000\n")) 259 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1633358050430467000\n")) 260 261 return level1TestResults 262 } 263 264 // GetTestData_Level1_10CountPass represents a level 1 summary (as exptected output from level 1 parser) 265 // with multiple passed tests, count=10. 266 func GetTestData_Level1_10CountPass() common.Level1Summary { 267 var level1TestResults []common.Level1TestResult 268 269 for i := 0; i < 10; i++ { 270 level1TestResults = append(level1TestResults, getPassedTest("TestSanitySha3_256")) 271 level1TestResults = append(level1TestResults, getPassedTest("TestSanitySha2_256")) 272 level1TestResults = append(level1TestResults, getPassedTest("TestSanitySha3_384")) 273 level1TestResults = append(level1TestResults, getPassedTest("TestSanitySha2_384")) 274 level1TestResults = append(level1TestResults, getPassedTest("TestSanityKmac128")) 275 } 276 277 for i := 0; i < 9; i++ { 278 level1TestResults = append(level1TestResults, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 279 level1TestResults = append(level1TestResults, getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10")) 280 } 281 level1TestResults = append(level1TestResults, getPassedTestElapsed("TestSha3/SHA3_384", 0.13, "0.13")) 282 level1TestResults = append(level1TestResults, getPassedTestElapsed("TestSha3/SHA3_256", 0.12, "0.12")) 283 284 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739552470379000\n")) 285 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739552696815000\n")) 286 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739552917474000\n")) 287 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739553140451000\n")) 288 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739553362249000\n")) 289 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739553605325000\n")) 290 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739553826502000\n")) 291 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739554054239000\n")) 292 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739554280043000\n")) 293 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739554500707000\n")) 294 295 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.23, "0.23", " hash_test.go:158: math rand seed is 1632739552470723000\n")) 296 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739552697024000\n")) 297 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739552917708000\n")) 298 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739553140702000\n")) 299 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.24, "0.24", " hash_test.go:158: math rand seed is 1632739553362497000\n")) 300 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739553605582000\n")) 301 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.23, "0.23", " hash_test.go:158: math rand seed is 1632739553826733000\n")) 302 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.23, "0.23", " hash_test.go:158: math rand seed is 1632739554054464000\n")) 303 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739554280256000\n")) 304 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739554500935000\n")) 305 306 return level1TestResults 307 } 308 309 // GetTestData_Level1_10CountSomeFailures represents a level 1 summary (as exptected output from level 1 parser) 310 // with multiple passed tests and a single failed test, count=10. 311 func GetTestData_Level1_10CountSomeFailures() common.Level1Summary { 312 var level1TestResults []common.Level1TestResult 313 314 for i := 0; i < 10; i++ { 315 level1TestResults = append(level1TestResults, getPassedTest("TestSanitySha3_256")) 316 level1TestResults = append(level1TestResults, getFailedTest_TestSanitySha2_256()) 317 level1TestResults = append(level1TestResults, getPassedTest("TestSanitySha3_384")) 318 level1TestResults = append(level1TestResults, getPassedTest("TestSanitySha2_384")) 319 level1TestResults = append(level1TestResults, getPassedTest("TestSanityKmac128")) 320 level1TestResults = append(level1TestResults, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 321 } 322 323 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739682184421000\n")) 324 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739682415309000\n")) 325 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739682637108000\n")) 326 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739682857435000\n")) 327 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739683077064000\n")) 328 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739683297507000\n")) 329 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739683518492000\n")) 330 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739683740724000\n")) 331 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739683980033000\n")) 332 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632739684200452000\n")) 333 334 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.23, "0.23", " hash_test.go:158: math rand seed is 1632739682184858000\n")) 335 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739682415616000\n")) 336 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739682637311000\n")) 337 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739682857668000\n")) 338 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739683077268000\n")) 339 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739683297711000\n")) 340 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739683518781000\n")) 341 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.24, "0.24", " hash_test.go:158: math rand seed is 1632739683740970000\n")) 342 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739683980266000\n")) 343 level1TestResults = append(level1TestResults, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1632739684200658000\n")) 344 345 for i := 0; i < 8; i++ { 346 level1TestResults = append(level1TestResults, getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10")) 347 } 348 349 level1TestResults = append(level1TestResults, getPassedTestElapsed("TestSha3/SHA3_256", 0.11, "0.11")) 350 level1TestResults = append(level1TestResults, getPassedTestElapsed("TestSha3/SHA3_256", 0.12, "0.12")) 351 352 return level1TestResults 353 } 354 355 // GetTestData_Level1_5CountSingleExceptionTest represents a level 1 summary (as exptected output from level 1 parser) 356 // with single no result test, count=5. 357 func GetTestData_Level1_5CountSingleExceptionTest() common.Level1Summary { 358 var level1TestResults []common.Level1TestResult 359 360 for i := 0; i < 5; i++ { 361 level1TestResults = append(level1TestResults, getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack()) 362 } 363 364 return level1TestResults 365 } 366 367 // GetTestData_Level1_5CountMultipleExceptionTests represents a level 1 summary (as expected output from level 1 parser) 368 // with single no result test and a passed test, count=5. 369 func GetTestData_Level1_5CountMultipleExceptionTests() common.Level1Summary { 370 var level1TestResults []common.Level1TestResult 371 for i := 0; i < 4; i++ { 372 level1TestResults = append(level1TestResults, getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack()) 373 } 374 level1TestResults = append(level1TestResults, getPassedTestPackageElapsedOutput("TestEncodableRandomBeaconPrivKeyMsgPack", "github.com/koko1123/flow-go-1/model/encodable", 0, "0.00", " keys_test.go:245: bytes: 194\n")) 375 376 return level1TestResults 377 } 378 379 // GetTestData_Leve1_3CountExceptionWithNormalTests represents a level 1 summary (as exptected output from level 1 parser) 380 // with single no result test and many passed tests, count=3. 381 func GetTestData_Leve1_3CountExceptionWithNormalTests() common.Level1Summary { 382 var level1TestResults []common.Level1TestResult 383 384 for i := 0; i < 3; i++ { 385 level1TestResults = append(level1TestResults, getPassedTestPackage("TestEncodableNetworkPrivKey", "github.com/koko1123/flow-go-1/model/encodable")) 386 level1TestResults = append(level1TestResults, getPassedTestPackage("TestEncodableNetworkPrivKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 387 level1TestResults = append(level1TestResults, getPassedTestPackage("TestEncodableNetworkPubKey", "github.com/koko1123/flow-go-1/model/encodable")) 388 level1TestResults = append(level1TestResults, getPassedTestPackage("TestEncodableNetworkPubKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 389 level1TestResults = append(level1TestResults, getPassedTestPackage("TestEncodableRandomBeaconPrivKey", "github.com/koko1123/flow-go-1/model/encodable")) 390 level1TestResults = append(level1TestResults, getPassedTestPackage("TestEncodableRandomBeaconPrivKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 391 level1TestResults = append(level1TestResults, getPassedTestPackage("TestEncodableRandomBeaconPubKey", "github.com/koko1123/flow-go-1/model/encodable")) 392 level1TestResults = append(level1TestResults, getPassedTestPackage("TestEncodableRandomBeaconPubKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 393 level1TestResults = append(level1TestResults, getPassedTestPackage("TestEncodableStakingPrivKey", "github.com/koko1123/flow-go-1/model/encodable")) 394 level1TestResults = append(level1TestResults, getPassedTestPackage("TestEncodableStakingPrivKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 395 level1TestResults = append(level1TestResults, getPassedTestPackage("TestEncodableStakingPubKey", "github.com/koko1123/flow-go-1/model/encodable")) 396 level1TestResults = append(level1TestResults, getPassedTestPackage("TestEncodableStakingPubKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 397 level1TestResults = append(level1TestResults, getPassedTestPackage("TestIsHexString", "github.com/koko1123/flow-go-1/model/encodable")) 398 level1TestResults = append(level1TestResults, getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack()) 399 } 400 401 return level1TestResults 402 } 403 404 // ********************************************************** 405 // ************** Level 2 Summaries Testing ***************** 406 // ********************************************************** 407 // The following GetTestData_Level2_*() functions are used by level 2 unit tests for constructing level 1 summaries 408 // that are used as inputs to generate level 2 summaries. 409 // Instead of having to represent these level 1 summaries as JSON files, they are represented as a list 410 // of structs to make them easier to maintain. 411 412 // GetTestData_Level2_1FailureRestPass represents a level 1 summary (as input into a level 2 parser) 413 // with count=1, many passed tests and a single failed test. 414 func GetTestData_Level2_1FailureRestPass() []common.Level1Summary { 415 var testResult1Rows []common.Level1TestResult 416 testResult1Rows = append(testResult1Rows, getFailedTest_TestSanitySha3_256()) 417 testResult1Rows = append(testResult1Rows, getPassedTest("TestSanitySha3_384")) 418 testResult1Rows = append(testResult1Rows, getPassedTest("TestSanitySha2_256")) 419 testResult1Rows = append(testResult1Rows, getPassedTest("TestSanitySha2_384")) 420 testResult1Rows = append(testResult1Rows, getPassedTest("TestSanityKmac128")) 421 testResult1Rows = append(testResult1Rows, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632498687765218000\n")) 422 testResult1Rows = append(testResult1Rows, getPassedTestElapsedOutput("TestSha3", 0.23, "0.23", " hash_test.go:158: math rand seed is 1632498687765661000\n")) 423 testResult1Rows = append(testResult1Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.11, "0.11")) 424 testResult1Rows = append(testResult1Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 425 426 var level1Summaries []common.Level1Summary 427 level1Summaries = append(level1Summaries, testResult1Rows) 428 return level1Summaries 429 } 430 431 // GetTestsData_Level2_1ExceptionNoOtherTests represents a level 1 summary (as input into a level 2 parser) 432 // with a single no result test and no other tests. 433 func GetTestsData_Level2_1ExceptionNoOtherTests() []common.Level1Summary { 434 var testResult1Rows []common.Level1TestResult 435 testResult1Rows = append(testResult1Rows, getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack()) 436 437 var leve1Summaries []common.Level1Summary 438 leve1Summaries = append(leve1Summaries, testResult1Rows) 439 return leve1Summaries 440 } 441 442 // GetTestData_Level2_MultipleL1SummariesExceptions represents multiple level 1 summaries (as input into a level 2 parser) 443 // and many tests with exceptions within the level level 1 summaries. 444 func GetTestData_Level2_MultipleL1SummariesExceptions() []common.Level1Summary { 445 446 // models level 1 summary with many passed tests and a single no result test, count=3 447 var testResult1Rows []common.Level1TestResult 448 for i := 0; i < 3; i++ { 449 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestEncodableNetworkPrivKey", "github.com/koko1123/flow-go-1/model/encodable")) 450 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestEncodableNetworkPrivKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 451 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestEncodableNetworkPubKey", "github.com/koko1123/flow-go-1/model/encodable")) 452 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestEncodableNetworkPubKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 453 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestEncodableRandomBeaconPrivKey", "github.com/koko1123/flow-go-1/model/encodable")) 454 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestEncodableRandomBeaconPrivKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 455 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestEncodableRandomBeaconPubKey", "github.com/koko1123/flow-go-1/model/encodable")) 456 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestEncodableRandomBeaconPubKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 457 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestEncodableStakingPrivKey", "github.com/koko1123/flow-go-1/model/encodable")) 458 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestEncodableStakingPrivKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 459 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestEncodableStakingPubKey", "github.com/koko1123/flow-go-1/model/encodable")) 460 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestEncodableStakingPubKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 461 testResult1Rows = append(testResult1Rows, getPassedTestPackage("TestIsHexString", "github.com/koko1123/flow-go-1/model/encodable")) 462 testResult1Rows = append(testResult1Rows, getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack()) 463 } 464 465 // models a level 1 summary with a single no result test, count=1 466 var testResult2Rows []common.Level1TestResult 467 testResult2Rows = append(testResult2Rows, getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack()) 468 469 // models level 1 summary with count=5 where 4 of the results are "no result" and the 5th one passed 470 var testResult3Rows []common.Level1TestResult 471 for i := 0; i < 4; i++ { 472 testResult3Rows = append(testResult3Rows, getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack()) 473 } 474 475 // the remaining 1 test runs (out of 5) has to be added manually since it wasn't an exception 476 testResult3Rows = append(testResult3Rows, getPassedTestPackageElapsedOutput("TestEncodableRandomBeaconPrivKeyMsgPack", "github.com/koko1123/flow-go-1/model/encodable", 0, "0.00", " keys_test.go:245: bytes: 194\n")) 477 478 // models level 1 summary for a single no result test, count=5 479 var testResult4Rows []common.Level1TestResult 480 for i := 0; i < 5; i++ { 481 testResult4Rows = append(testResult4Rows, getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack()) 482 } 483 484 var level1Summaries []common.Level1Summary 485 level1Summaries = append(level1Summaries, testResult1Rows) 486 level1Summaries = append(level1Summaries, testResult2Rows) 487 level1Summaries = append(level1Summaries, testResult3Rows) 488 level1Summaries = append(level1Summaries, testResult4Rows) 489 return level1Summaries 490 } 491 492 // GetTestData_Level2MultipleL1SummariesFailuresPasses represents multiple level 1 summaries (as input into a level 2 parser) 493 // where there are many passed and failed tests within the level level 1 summaries. 494 func GetTestData_Level2MultipleL1SummariesFailuresPasses() []common.Level1Summary { 495 // level 1 summary with many passed tests and 1 failed test, count=1 496 var level1TestResult1Rows []common.Level1TestResult 497 level1TestResult1Rows = append(level1TestResult1Rows, getFailedTest_TestSanitySha3_256()) 498 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTest("TestSanitySha3_384")) 499 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTest("TestSanitySha2_256")) 500 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTest("TestSanitySha2_384")) 501 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTest("TestSanityKmac128")) 502 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632498687765218000\n")) 503 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTestElapsedOutput("TestSha3", 0.23, "0.23", " hash_test.go:158: math rand seed is 1632498687765661000\n")) 504 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.11, "0.11")) 505 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 506 507 // level 1 summary with many passed tests, count=1 508 var level1TestResult2Rows []common.Level1TestResult 509 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTest("TestSanitySha3_256")) 510 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTest("TestSanitySha2_256")) 511 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTest("TestSanitySha3_384")) 512 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTest("TestSanitySha2_384")) 513 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTest("TestSanityKmac128")) 514 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632497249121800000\n")) 515 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTestElapsedOutput("TestSha3", 0.23, "0.23", " hash_test.go:158: math rand seed is 1632497249122032000\n")) 516 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10")) 517 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 518 519 // level 1 summary with many passed tests, count=1 520 var level1TestResult3Rows []common.Level1TestResult 521 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTest("TestSanitySha3_256")) 522 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTest("TestSanitySha2_256")) 523 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTest("TestSanitySha3_384")) 524 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTest("TestSanitySha2_384")) 525 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTest("TestSanityKmac128")) 526 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTestElapsedOutput("TestSha3", 0.24, "0.24", " hash_test.go:160: math rand seed is 1633518697589650000\n")) 527 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.11, "0.11")) 528 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.13, "0.13")) 529 530 // level 1 summary with many passed tests, count=2 531 var level1TestResult4Rows []common.Level1TestResult 532 for i := 0; i < 2; i++ { 533 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanitySha3_256")) 534 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanitySha2_256")) 535 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanitySha3_384")) 536 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanitySha2_384")) 537 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanityKmac128")) 538 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10")) 539 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 540 } 541 542 // the following test results have to be added manually (i.e. not in a loop) because 543 // they have unique data generated in the output / duration each time they're run 544 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1633358050430256000\n")) 545 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1633358050203144000\n")) 546 547 // the following test results have to be added manually (i.e. not in a loop) because 548 // they have unique data generated in the output / duration each time they're run 549 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTestElapsedOutput("TestSha3", 0.23, "0.23", " hash_test.go:158: math rand seed is 1633358050203374000\n")) 550 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTestElapsedOutput("TestSha3", 0.22, "0.22", " hash_test.go:158: math rand seed is 1633358050430467000\n")) 551 552 // level 1 summary with many passed tests, count=10 553 var level1TestResult5Rows []common.Level1TestResult 554 for i := 0; i < 10; i++ { 555 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTest("TestSanitySha3_256")) 556 level1TestResult5Rows = append(level1TestResult5Rows, getFailedTest_TestSanitySha2_256()) 557 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTest("TestSanitySha3_384")) 558 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTest("TestSanitySha2_384")) 559 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTest("TestSanityKmac128")) 560 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTest("TestHashersAPI")) 561 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 562 } 563 564 // the following test results have to be added in a separate loop because their results are the same 8 times out 10 test runs 565 for i := 0; i < 8; i++ { 566 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3", 0.22, "0.22")) 567 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10")) 568 } 569 570 // the remaining 2 test runs (out of 10) have to be added manually since they have unique duration data not present in the other test runs 571 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3", 0.24, "0.24")) 572 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3", 0.23, "0.23")) 573 574 // the remaining 2 test runs (out of 10) have to be added manually since they have unique duration data not present in the other test runs 575 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.12, "0.12")) 576 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.11, "0.11")) 577 578 // level 1 summary with many passed tests, count=10 579 var level1TestResult6Rows []common.Level1TestResult 580 for i := 0; i < 10; i++ { 581 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTest("TestSanitySha3_256")) 582 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTest("TestSanitySha2_256")) 583 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTest("TestSanitySha3_384")) 584 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTest("TestSanitySha2_384")) 585 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTest("TestSanityKmac128")) 586 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTest("TestHashersAPI")) 587 } 588 589 // the following test results have to be added in a separate loop because their results are the same 6 times out 10 test runs 590 for i := 0; i < 6; i++ { 591 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3", 0.22, "0.22")) 592 } 593 // the remaining 4 test runs (out of 10) have to be added manually since they have unique duration data not present in the other test runs 594 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3", 0.23, "0.23")) 595 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3", 0.24, "0.24")) 596 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3", 0.23, "0.23")) 597 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3", 0.23, "0.23")) 598 599 // the following test results have to be added in a separate loop because their results are the same 9 times out 10 test runs 600 for i := 0; i < 9; i++ { 601 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10")) 602 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 603 } 604 605 // the remaining 1 test run (out of 10) has to be added manually since it has unique duration data not present in the other test runs 606 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.12, "0.12")) 607 608 // the remaining 1 test run (out of 10) has to be added manually since it has unique duration data not present in the other test runs 609 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.13, "0.13")) 610 611 var level1Summaries []common.Level1Summary 612 level1Summaries = append(level1Summaries, level1TestResult1Rows) 613 level1Summaries = append(level1Summaries, level1TestResult2Rows) 614 level1Summaries = append(level1Summaries, level1TestResult3Rows) 615 level1Summaries = append(level1Summaries, level1TestResult4Rows) 616 level1Summaries = append(level1Summaries, level1TestResult5Rows) 617 level1Summaries = append(level1Summaries, level1TestResult6Rows) 618 return level1Summaries 619 } 620 621 // GetTestData_Level2MultipleL1SummariesFailuresPassesExceptions represents multiple level 1 summaries (as input into a level 2 parser) 622 // where there are many passed, failed and no result tests within the level level 1 summaries. 623 func GetTestData_Level2MultipleL1SummariesFailuresPassesExceptions() []common.Level1Summary { 624 // level 1 summary with many passed tests, 1 failed test, count=1 625 var level1TestResult1Rows []common.Level1TestResult 626 level1TestResult1Rows = append(level1TestResult1Rows, getFailedTest_TestSanitySha3_256()) 627 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTest("TestSanitySha3_384")) 628 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTest("TestSanitySha2_256")) 629 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTest("TestSanitySha2_384")) 630 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTest("TestSanityKmac128")) 631 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTestElapsedOutput("TestHashersAPI", 0, "0.00", " hash_test.go:114: math rand seed is 1632498687765218000\n")) 632 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTestElapsedOutput("TestSha3", 0.23, "0.23", " hash_test.go:158: math rand seed is 1632498687765661000\n")) 633 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.11, "0.11")) 634 level1TestResult1Rows = append(level1TestResult1Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 635 636 // level 1 summary with many passed tests, count=1 637 var level1TestResult2Rows []common.Level1TestResult 638 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTest("TestSanitySha3_256")) 639 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTest("TestSanitySha2_256")) 640 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTest("TestSanitySha3_384")) 641 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTest("TestSanitySha2_384")) 642 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTest("TestSanityKmac128")) 643 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTest("TestHashersAPI")) 644 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTestElapsed("TestSha3", 0.23, "0.23")) 645 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10")) 646 level1TestResult2Rows = append(level1TestResult2Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 647 648 // level 1 summary with many passed tests, count=1 649 var level1TestResult3Rows []common.Level1TestResult 650 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTest("TestSanitySha3_256")) 651 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTest("TestSanitySha3_384")) 652 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTest("TestSanitySha2_384")) 653 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTest("TestSanityKmac128")) 654 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTestElapsed("TestSha3", 0.24, "0.24")) 655 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.11, "0.11")) 656 level1TestResult3Rows = append(level1TestResult3Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.13, "0.13")) 657 658 // level 1 summary with many passed tests, count=1 659 var level1TestResult4Rows []common.Level1TestResult 660 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanitySha3_256")) 661 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanitySha3_256")) 662 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanitySha2_256")) 663 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanitySha2_256")) 664 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanitySha3_384")) 665 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanitySha3_384")) 666 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanitySha2_384")) 667 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanitySha2_384")) 668 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanityKmac128")) 669 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestSanityKmac128")) 670 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestHashersAPI")) 671 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTest("TestHashersAPI")) 672 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTestElapsed("TestSha3", 0.23, "0.23")) 673 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTestElapsed("TestSha3", 0.22, "0.22")) 674 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10")) 675 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10")) 676 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 677 level1TestResult4Rows = append(level1TestResult4Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 678 679 // level 1 summary with many passed tests, 1 failed test, count=10 680 var level1TestResult5Rows []common.Level1TestResult 681 682 for i := 0; i < 10; i++ { 683 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTest("TestSanitySha3_256")) 684 level1TestResult5Rows = append(level1TestResult5Rows, getFailedTest_TestSanitySha2_256()) 685 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTest("TestSanitySha3_384")) 686 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTest("TestSanitySha2_384")) 687 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTest("TestSanityKmac128")) 688 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTest("TestHashersAPI")) 689 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 690 } 691 692 // the following test results have to be added in a separate loop because their results are the same 8 times out 10 test runs 693 for i := 0; i < 8; i++ { 694 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3", 0.22, "0.22")) 695 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10")) 696 } 697 698 // the remaining 2 test runs (out of 10) have to be added manually since they have unique duration data not present in the other test runs 699 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3", 0.24, "0.24")) 700 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3", 0.23, "0.23")) 701 702 // the remaining 2 test runs (out of 10) have to be added manually since they have unique duration data not present in the other test runs 703 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.12, "0.12")) 704 level1TestResult5Rows = append(level1TestResult5Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.11, "0.11")) 705 706 // level 1 summary with many passed tests, count=10 707 var level1TestResult6Rows []common.Level1TestResult 708 for i := 0; i < 10; i++ { 709 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTest("TestSanitySha3_256")) 710 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTest("TestSanitySha2_256")) 711 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTest("TestSanitySha3_384")) 712 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTest("TestSanitySha2_384")) 713 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTest("TestSanityKmac128")) 714 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTest("TestHashersAPI")) 715 } 716 717 // the following test results have to be added in a separate loop because their results are the same 9 times out 10 test runs 718 for i := 0; i < 9; i++ { 719 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.1, "0.10")) 720 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.12, "0.12")) 721 } 722 // the remaining 1 test run (out of 10) have to be added manually since they have unique duration data not present in the other test runs 723 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3/SHA3_256", 0.12, "0.12")) 724 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3/SHA3_384", 0.13, "0.13")) 725 726 // the following test results have to be added in a separate loop because their results are the same 6 times out 10 test runs 727 for i := 0; i < 6; i++ { 728 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3", 0.22, "0.22")) 729 } 730 // the remaining 4 test runs (out of 10) have to be added manually since they have unique duration data not present in the other test runs 731 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3", 0.24, "0.24")) 732 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3", 0.23, "0.23")) 733 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3", 0.23, "0.23")) 734 level1TestResult6Rows = append(level1TestResult6Rows, getPassedTestElapsed("TestSha3", 0.23, "0.23")) 735 736 // level 1 summary with many passed tests, 1 no result test, count=3 737 var level1TestResult7Rows []common.Level1TestResult 738 for i := 0; i < 3; i++ { 739 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestEncodableNetworkPrivKey", "github.com/koko1123/flow-go-1/model/encodable")) 740 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestEncodableNetworkPrivKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 741 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestEncodableNetworkPubKey", "github.com/koko1123/flow-go-1/model/encodable")) 742 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestEncodableNetworkPubKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 743 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestEncodableRandomBeaconPrivKey", "github.com/koko1123/flow-go-1/model/encodable")) 744 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestEncodableRandomBeaconPrivKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 745 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestEncodableRandomBeaconPubKey", "github.com/koko1123/flow-go-1/model/encodable")) 746 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestEncodableRandomBeaconPubKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 747 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestEncodableStakingPrivKey", "github.com/koko1123/flow-go-1/model/encodable")) 748 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestEncodableStakingPrivKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 749 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestEncodableStakingPubKey", "github.com/koko1123/flow-go-1/model/encodable")) 750 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestEncodableStakingPubKeyNil", "github.com/koko1123/flow-go-1/model/encodable")) 751 level1TestResult7Rows = append(level1TestResult7Rows, getPassedTestPackage("TestIsHexString", "github.com/koko1123/flow-go-1/model/encodable")) 752 level1TestResult7Rows = append(level1TestResult7Rows, getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack()) 753 } 754 755 // level 1 summary with 1 no result test, count=1 756 var level1TestResult8Rows []common.Level1TestResult 757 level1TestResult8Rows = append(level1TestResult8Rows, getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack()) 758 759 // level 1 summary with 1 no result test, 1 passed test, count=5 760 var level1TestResult9Rows []common.Level1TestResult 761 for i := 0; i < 4; i++ { 762 level1TestResult9Rows = append(level1TestResult9Rows, getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack()) 763 } 764 // the remaining 1 test runs (out of 5) have to be added manually since it wasn't an exception 765 level1TestResult9Rows = append(level1TestResult9Rows, getPassedTestPackage("TestEncodableRandomBeaconPrivKeyMsgPack", "github.com/koko1123/flow-go-1/model/encodable")) 766 767 // level 1 summary with 1 no result test, count=5 768 var level1TestResult10Rows []common.Level1TestResult 769 for i := 0; i < 5; i++ { 770 level1TestResult10Rows = append(level1TestResult10Rows, getExceptionTest_TestEncodableRandomBeaconPrivKeyMsgPack()) 771 } 772 773 var level1Summaries []common.Level1Summary 774 level1Summaries = append(level1Summaries, level1TestResult1Rows) 775 level1Summaries = append(level1Summaries, level1TestResult2Rows) 776 level1Summaries = append(level1Summaries, level1TestResult3Rows) 777 level1Summaries = append(level1Summaries, level1TestResult4Rows) 778 level1Summaries = append(level1Summaries, level1TestResult5Rows) 779 level1Summaries = append(level1Summaries, level1TestResult6Rows) 780 level1Summaries = append(level1Summaries, level1TestResult7Rows) 781 level1Summaries = append(level1Summaries, level1TestResult8Rows) 782 level1Summaries = append(level1Summaries, level1TestResult9Rows) 783 level1Summaries = append(level1Summaries, level1TestResult10Rows) 784 return level1Summaries 785 }