Added total test count. Fixed some images.

master
sigonasr2 4 years ago
parent f6bad295e3
commit 8e91027542
  1. BIN
      arrow.png
  2. BIN
      bot.png
  3. 7
      game.js
  4. 7
      game.test.js

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 646 B

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -2,12 +2,10 @@ var canvas;
const IMAGE_CONVEYOR = new Image();
IMAGE_CONVEYOR.src ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAANCAYAAADISGwcAAAACXBIWXMAAADGAAAAxgGwdJvFAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAj5JREFUOI2l1V1IU2Ecx/Hv2dnOfKlIirpRb3xJyJokBFl04bVeF0QvFhKGiImGWzrdUDY0dFik2Jt0YQVGRBJBb2Io5lstMs2yi6LoSgqlbWc753TVbJ0zJfe7/H84D7/n/C8ewTc4pGGQsBzCIlmNaA2TsUiSoRnFFA/mX0/x9O4tQ5sefsbk88eG9mLwHu8mxhIvADDY18vIw/u6uaao9Pu8+EeGdaZEwtzwNPHBP514AU3TGOj2Mfrogc5UReFmu5uZ8VGdheUQV9x2Ft76EysAUFKyn4HLnUwNPYmZS1aJ4uJC+rzNvH81GWNbtqZhs2Vx1W3n8/xsYgWqqw9RWnqA/k4Pb0ZXfrkgCDQ3naJoXz7XWs7H3NZiEWlvqyRvRwY9zjq+fvq4/gKCIFBTc5jNaRu4c/ECocCvqImiCYfjGGZRoN/nRVWUqCUlSTQ2liEHA9zualt/gUhEoaGhl6WlIGUON9bklKiFQjL19m4wmTlR78IkilFbXg5gd/SQsnETR2sb455vXquAy3Wd8YlZyp0esncVROeaqlJbd4m5uS9UtHaQkZ0bNTkUpqqqk2/ff1Dp7WJbesb/F1BVFYCxlzOcdLjJLShcMU1FlsP4/QucdrWRmZMX893i4k+CssKZ1g62p2euesG4K9A0DZMocvyck517i/5FLJKVcqeHrHybzpJTU6lo6SA9K5e1EreAIAgcOVvP7qKDOhPNZsrsLnJse3T2p9jfK1ktQry3QIlEEM3GG1qvGeU3ALjbp7CJK1kAAAAASUVORK5CYII="
const IMAGE_WRITER = new Image();
IMAGE_WRITER.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAACgAAAAoAFdfrujAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAOhJREFUWIVjZCARhDX17njy4Ys5NjklYYHlS6rzs0gxj4VUB7z+/J352aevAtjkeDnYSTWOgYlkHVQGow4YdcCoA0YdMOAOYIxtm3T61ddvrETr+P9f6eefv7zYpNhZWN4yMDI8IdYoMW6u3yx337xXwVW2kwGEoZgo8Jnv54cBj4JRB4w6gEVfUmSOojD/f2I1fPv9J+z9tx/y2OREuLkusLMw7SbWLD42VkZGYhXDgGNpy+777z+5YJNTFxOavrOtgqQ24YBHwagDRh0w6oBRBwy4A0juHYvycv79+ffvB6xy3JwkOwAAdhs7qElosC8AAAAASUVORK5CYII="
const IMAGE_ARROW = new Image();
IMAGE_ARROW.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAPCAYAAAAoAdW+AAAACXBIWXMAAAC/AAAAvwFipAVzAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAQlJREFUGJVdzrGRglAUheEfeD4YjB4WYCQJWILRFgAFODSxySaWsP1sAQQWQEgCZAQwOs7AA5EN3MFxT/rNufcYp9Np7rqONE05n8/85Rv4MtfrNa7rcjgciOMYKeUMfAI/pmVZeJ6HbdvsdjuSJDE2mw3Ah2kYBmEYopRCSolSiuPxiO/7mABCCPb7PUopVqsVUkqiKHoigJRyuSCEAHghgOM4BEGAUgrLshD8i+u6bLdbpml6bwL0fU9Zllwul3fUWpNlGU3ToLV+4TiOZFlG27bc73eqqnriNE0LDMMAQFEUmPM8L6C1Xl4URYH5eDxo25au6xa4Xq/UdY243W70ff+2OM9zAH4BBIduqM7GcJMAAAAASUVORK5CYII="
IMAGE_ARROW.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAPCAYAAAAoAdW+AAAACXBIWXMAAAC/AAAAvwFipAVzAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAPZJREFUGJV1z7FKxTAUBuCfJE2gSxHnPkCb1QdwcxRHB90EFycxlK4X2pR08g0cBCc38QHcndri3P0iOpTamHAXKdZ7/cfzcTj/QVmW1/gnhBCyquv6aidSSr845yut9fmuze80TSMhxK0x5niBAMAYg5QyopTeGWMOFwgAnHNIKSNCyGNVVQcLBAAhBJIk2WOMPRdFkS4QAMIwRBzH+0EQ3G/hMAzo+35trT1d4DiO6Lpu7b0/yvP8bcZpmtC27bv3/kQp9ToXstaiaZoPa+2ZUuplfsV7z9q2/XTOXWZZ9vT7DHPOBd77G6XUw99y0FpfbA1/sgGJmFq8ighWbQAAAABJRU5ErkJggg=="
const IMAGE_BOT = new Image();
IMAGE_BOT.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAgCAYAAAD5VeO1AAAACXBIWXMAAABrAAAAawEOX1tRAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAhNJREFUSIntk29IE2Ecx7+3u905162x2IS5cbgj0Ep0w6G9EQshDIwZFRq+7IVQ+NK3e7FXgi/TIAoDX0Rofxn4Ynu34QIXV4Nhb+auEa5DzjxLt/OY1wtx2Fw1ohe9uM+rh9/zPB/4fnkewMDA4P+FaOTQnf7+jh6fj3Pb7cTnrS0tns9nXyQSxb+WR0Ih/kpn5z0nyw57HA6eMpmqe3v7+5WN7e33BVleeiYIDx7G40o9B1lv+HpycvRGMPiSd7kuvxNFx2o+j7MtLaBIEkVFwZNk0mSzWNwD7e2D3a2t1857vak3gvDlj/L74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KJoGkatm1z584d2mv0rVu3WFlZwe/3c/z4cfbv398CTafTFAoFyuUyAKqqsrGxAc7t9Re0Vq4IMBkKhXDrsmEY1Ot1SqUSpmm6a0QwGOTIkSP09fUxOztLKpUCnHNcKBQoFAotZ15RFNfqy8CP8NRqaNidTqexbbvZWKlU2NzcbLFclmUEQaBWq9Hf398y23YoPF1CnIuHdvBt4O8nT56Qy+VaBlYqFTRNQxCe3qJzc3MoisKJEyeabaqqNl1xVS6X3XybOHfBM2CALwHm5+dp19bWVssuf/z4MdPT0/j9/mabYRjPjFtYWHAdvALoncBfAcbi4iK6rtNNyWSyxYFOWlhYcP9+s729HfwPcN0wDO7evds1Yfu676Riscj6+rqbd7YbGOAL2Nnu7RofHycQCHSNaZttfXuf95loZ7tvrqysDKqqSl/f7r/XTdPEMAwsy0LX9e3gy+2xnRbpE+CSz+fD4+n0WQaiKGJZFvV6nXq93ilsFRjBuRya2mnG4Nh90TCM9p3aC/jaYlUcGzWcXVsFtoAaUMEpkXbbGP4DeoT7jGhhWUQAAAAASUVORK5CYII="
const IMAGE_QUESTIONMARK = new Image();
@ -415,6 +413,7 @@ function draw() {
ctx.fillStyle="#000000"
ctx.stroke();
//drawImage(0,0,IMAGE_CONVEYOR,ctx,0)
drawImage(64,64,IMAGE_ARROW,ctx,0)
}
function ConsumeTape() {

@ -11,6 +11,8 @@ function loadScript(url, callback)
var testsPass=undefined;
var TestSuite;
var totalTests = 0;
var totalTestsPassed = 0;
class describe {
constructor(testname) {
@ -48,11 +50,14 @@ function expect(testval1,testval2,name) {
if (testval1!==testval2) {
console.log(" Test Failed! Expected "+testval2+" but got "+testval1+". ("+(new Date().getTime()-TestSuite.starttime)+"ms)"+((name)?` - ${name}`:""))
TestSuite.totaltests++
totalTests++
testsPass=false
} else
{
TestSuite.totaltests++
TestSuite.passedtests++
totalTests++
totalTestsPassed++
console.log(" Test Passed!"+" ("+(new Date().getTime()-TestSuite.starttime)+"ms)"+((name)?` - ${name}`:""))
}
}
@ -462,6 +467,8 @@ function runTests() {
expect(colorToHex(58, 79, 55),"#3a4f37")
}).showResults()
console.log("----------------------")
console.log("ALL TESTS: "+totalTestsPassed+" passed, "+(totalTests-totalTestsPassed)+" failed, "+totalTests+" total")
if (testsPass===undefined) {
testsPass=true
}

Loading…
Cancel
Save