(module, testName)
| 277 | // Based on Java's String.hashCode, a simple but not |
| 278 | // rigorously collision resistant hashing function |
| 279 | function generateHash(module, testName) { |
| 280 | var str = module + "\x1C" + testName; |
| 281 | var hash = 0; |
| 282 | |
| 283 | for (var i = 0; i < str.length; i++) { |
| 284 | hash = (hash << 5) - hash + str.charCodeAt(i); |
| 285 | hash |= 0; |
| 286 | } |
| 287 | |
| 288 | // Convert the possibly negative integer hash code into an 8 character hex string, which isn't |
| 289 | // strictly necessary but increases user understanding that the id is a SHA-like hash |
| 290 | var hex = (0x100000000 + hash).toString(16); |
| 291 | if (hex.length < 8) { |
| 292 | hex = "0000000" + hex; |
| 293 | } |
| 294 | |
| 295 | return hex.slice(-8); |
| 296 | } |
| 297 | |
| 298 | // Test for equality any JavaScript type. |
| 299 | // Authors: Philippe Rathé <prathe@gmail.com>, David Chan <david@troi.org> |
no outgoing calls
no test coverage detected