Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroth committed Aug 28, 2024
1 parent 9135ccb commit cf87793
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions test/resources/snapshot1.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
Outdated base version: https://github.com/primer/github-syntax-dark
Current colors taken from GitHub's CSS
*/.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#79c0ff}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-code,.hljs-comment,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}</style><p><span><div class="quote" ><p><span><span>lorem </span><strong><span><span>ipsum</span></span></strong><span> </span><span><span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6679em;"></span><span class="mord accent"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6679em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord mathnormal">x</span></span><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.1111em;"><span class="mord">˙</span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7667em;vertical-align:-0.0833em;"></span><span class="mord"></span><span class="mord"></span><span class="mord mathnormal" style="margin-right:0.22222em;">V</span></span></span></span></span><span>!</span></span></p><span><div style="position: relative;" ><pre class="base_code block_code" ><code class="language-python" ><span class="hljs-keyword">def</span> <span class="hljs-title function_">factorial</span>(<span class="hljs-params">n</span>):
*/.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#79c0ff}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-code,.hljs-comment,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}</style><p><span><div class="quote" ><p><span><span>lorem </span><strong><span><span>ipsum</span></span></strong><span> </span><span><span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6679em;"></span><span class="mord accent"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6679em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord mathnormal">x</span></span><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.1111em;"><span class="mord">˙</span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7667em;vertical-align:-0.0833em;"></span><span class="mord"></span><span class="mord"></span><span class="mord mathnormal" style="margin-right:0.22222em;">V</span></span></span></span></span><span>!</span></span></p><p><span><div style="position: relative;" ><pre class="base_code block_code" ><code class="language-python" ><span class="hljs-keyword">def</span> <span class="hljs-title function_">factorial</span>(<span class="hljs-params">n</span>):
<span class="hljs-keyword">return</span> <span class="hljs-number">1</span> <span class="hljs-keyword">if</span> n &lt;= <span class="hljs-number">0</span> <span class="hljs-keyword">else</span> n * factorial(n - <span class="hljs-number">1</span>)
</code></pre><button class="nd_copy" title="Copy to clipboard" ><span style="display: flex; flex-direction:row;" ><span class="nd_copy" >COPY</span><svg viewBox="0 0 24 24" class="nd_copy" ><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" ></path></svg></span></button></div></span></div></span></p></p></span></p><p><span><span>Also inline ?? </span><span><span class="quote" ><span><span>a inline </span><code class="base_code line_code" >custom</code><span> does work</span></span></span></span><span> !!</span></span></p><p><span><span><span class="katex-display"><span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:2.2719em;vertical-align:-0.9119em;"></span><span class="mop"><span class="mop op-symbol large-op" style="margin-right:0.44445em;position:relative;top:-0.0011em;"></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:-0.4258em;"><span style="top:-1.7881em;margin-left:-0.4445em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight" style="margin-right:0.05556em;"></span><span class="mord mtight">Ω</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.9119em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal" style="margin-right:0.0037em;">α</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:2.2719em;vertical-align:-0.9119em;"></span><span class="mop"><span class="mop op-symbol large-op" style="margin-right:0.44445em;position:relative;top:-0.0011em;"></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:-0.4336em;"><span style="top:-1.7881em;margin-left:-0.4445em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">Ω</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.9119em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord text"><span class="mord">d</span></span><span class="mord mathnormal" style="margin-right:0.0037em;">α</span></span></span></span></span></span></span></p><p><h1 id="tests-unicode-&spades;" ><span><span>Tests unicode &spades;</span></span></h1></p><p><span><a href="" ><span><span>link with &hearts;</span></span></a></span></p><p><span><p><span><span>html with &hearts;</span></span></p></span></p><p><span><span>normal with &hearts;</span></span></p><p><span><strong><span><span>bold with &hearts;</span></span></strong></span></p><p><span><em><span><span>italic with &hearts;</span></span></em></span></p><p><span><div align="center" ><canvas id="canvas" width="560" height="400" ></canvas></div></span></p><p><span><script src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.4.8/processing.min.js" ></script></span></p><p><span><script>
</code></pre><button class="nd_copy" title="Copy to clipboard" ><span style="display: flex; flex-direction:row;" ><span class="nd_copy" >COPY</span><svg viewBox="0 0 24 24" class="nd_copy" ><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" ></path></svg></span></button></div></span></p></div></span></p></p></span></p><p><span><span>Also inline ?? </span><span><span class="quote" ><span><span>a inline </span><code class="base_code line_code" >custom</code><span> does work</span></span></span></span><span> !!</span></span></p><p><span><span><span class="katex-display"><span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:2.2719em;vertical-align:-0.9119em;"></span><span class="mop"><span class="mop op-symbol large-op" style="margin-right:0.44445em;position:relative;top:-0.0011em;"></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:-0.4258em;"><span style="top:-1.7881em;margin-left:-0.4445em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight" style="margin-right:0.05556em;"></span><span class="mord mtight">Ω</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.9119em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal" style="margin-right:0.0037em;">α</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:2.2719em;vertical-align:-0.9119em;"></span><span class="mop"><span class="mop op-symbol large-op" style="margin-right:0.44445em;position:relative;top:-0.0011em;"></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:-0.4336em;"><span style="top:-1.7881em;margin-left:-0.4445em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">Ω</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.9119em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord text"><span class="mord">d</span></span><span class="mord mathnormal" style="margin-right:0.0037em;">α</span></span></span></span></span></span></span></p><p><h1 id="tests-unicode-&spades;" ><span><span>Tests unicode &spades;</span></span></h1></p><p><span><a href="" ><span><span>link with &hearts;</span></span></a></span></p><p><span><p><span><span>html with &hearts;</span></span></p></span></p><p><span><span>normal with &hearts;</span></span></p><p><span><strong><span><span>bold with &hearts;</span></span></strong></span></p><p><span><em><span><span>italic with &hearts;</span></span></em></span></p><p><span><div align="center" ><canvas id="canvas" width="560" height="400" ></canvas></div></span></p><p><span><script src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.4.8/processing.min.js" ></script></span></p><p><span><script>
var canvas=document.getElementById("canvas");var processing=new Processing(canvas,function(processing){processing.size(400,400);processing.background(4095);var mouseIsPressed=false;processing.mousePressed=function(){mouseIsPressed=true};processing.mouseReleased=function(){mouseIsPressed=false};var keyIsPressed=false;processing.keyPressed=function(){keyIsPressed=true};processing.keyReleased=function(){keyIsPressed=false};function getImage(s){var url="https://www.kasandbox.org/programming-images/"+s+".png";processing.externals.sketch.imageCache.add(url);return processing.loadImage(url)}var rotateFn=processing.rotate;processing.rotate=function(angle){rotateFn(processing.radians(angle))};with(processing){var numberOfReds;var numberOfBlacks;var numberOfGreens;var currentTime;var oldTime;var tablePhase;var state;var time;var ballPos;var ballVel;var winnerNumber;var winnerColor;var myMoney;var redButtonHover;var blackButtonHover;var redButtonPressed;var blackButtonPressed;var myColor;var bet;var isLose;var numbers=[];var numbersColor=[];var xmin=-5;var xmax=5;var ymin=-5;var ymax=5;var w=400;var h=400;var swap=function(v,i,j){var temp=v[i];v[i]=v[j];v[j]=temp};var init=function(){var size=37;for(var i=0;i<size;i++){numbers[i]=i}for(var i=0;i<size;i++){swap(numbers,i,floor(random(0,size-1)))}tablePhase=0;oldTime=millis()*.001;state=0;time=0;ballPos=0;myMoney=10;bet=0;redButtonHover=false;blackButtonHover=false;redButtonPressed=false;blackButtonPressed=false;myColor="none";numberOfGreens=0;numberOfReds=0;numberOfBlacks=0;isLose=false};var changeXcoord=function(x){return(x-xmin)*w/abs(xmax-xmin)};var changeYcoord=function(y){return-((y-ymax)*h)/abs(ymax-ymin)};var drawLine=function(x1,y1,x2,y2){var i1=changeXcoord(x1);var j1=changeYcoord(y1);var i2=changeXcoord(x2);var j2=changeYcoord(y2);line(i1,j1,i2,j2)};var drawString=function(str,x,y){var i1=changeXcoord(x);var j1=changeYcoord(y);text(str,i1,j1)};var drawEllipse=function(x,y,w,h){var i=changeXcoord(x);var j=changeYcoord(y);var wt=changeXcoord(x+w);var ht=changeYcoord(y+h);wt=wt-i;ht=ht-j;ellipse(i,j,wt,ht)};var drawRect=function(x,y,w,h){var i=changeXcoord(x);var j=changeYcoord(y);var wt=changeXcoord(x+w);var ht=changeYcoord(y+h);wt=wt-i;ht=ht-j;rect(i,j,wt,ht)};var mouseMoved=function(){if(state===0){if(mouseX>16&&mouseX<76&&mouseY>357&&mouseY<387&&!redButtonPressed){redButtonHover=true}else{redButtonHover=false}if(mouseX>88&&mouseX<138&&mouseY>357&&mouseY<387&&!blackButtonPressed){blackButtonHover=true}else{blackButtonHover=false}}};var mouseClicked=function(){var logic=false;if(state===0){if(mouseX>16&&mouseX<76&&mouseY>357&&mouseY<387){redButtonPressed=true;if(blackButtonPressed){bet=0;blackButtonPressed=false}myColor="red";logic=true}if(mouseX>88&&mouseX<138&&mouseY>357&&mouseY<387){blackButtonPressed=true;if(redButtonPressed){bet=0;redButtonPressed=false}myColor="black";logic=true}if(logic&&bet<myMoney){bet++}}};var drawRoullete=function(theta,radius){var size=37;var step=2*Math.PI/size;fill(34,255,0);textSize(14);for(var i=0;i<size;i++){var x=i*step;var n=numbers[i];if(n===0){numbersColor[i]="green";fill(0,255,89)}else{if(i%2===0){numbersColor[i]="red";fill(255,0,0)}else{numbersColor[i]="black";fill(0,0,0)}}drawString(n,radius*Math.cos(x+theta),radius*Math.sin(x+theta))}};var findWinnerIndex=function(){var size=37;var step=2*Math.PI/size;var raw=ballPos%(2*Math.PI);var phi=tablePhase%(2*Math.PI);var ci;if(raw-phi<0){ci=(2*Math.PI-phi+raw)/step}else{ci=(raw-phi)/step}return Math.floor(ci)};var drawBall=function(){var radius=2.7;var r=.2;fill(0,0,0);drawEllipse(radius*Math.cos(ballPos),radius*Math.sin(ballPos),r,r)};var drawRedButton=function(){if(redButtonHover){fill(166,2,2);rect(16,357,60,30)}else if(redButtonPressed){fill(0,255,30);rect(16,357,60,30)}else{fill(255,0,0);rect(16,357,60,30)}fill(255,255,255);textSize(22);drawString("Red",-4.4,-4.5)};var drawBlackButton=function(){if(blackButtonHover){fill(122,122,122);rect(88,357,60,30)}else if(blackButtonPressed){fill(0,255,51);rect(88,357,60,30)}else{fill(0,0,0);rect(88,357,60,30)}fill(255,255,255);textSize(22);drawString("Black",-2.7,-4.5)};var drawButtons=function(){if(state===0){drawRedButton();drawBlackButton()}};var resetButtons=function(){redButtonPressed=false;redButtonHover=false;blackButtonPressed=false;blackButtonHover=false};var checkIfWin=function(){if(winnerColor===myColor){return true}else{return false}};var drawWinLose=function(){var isWin=checkIfWin();if(winnerColor==="red"){fill(255,0,0);textSize(16);drawString("Winner Number: "+winnerNumber,-1.5,0)}if(winnerColor==="green"){fill(0,255,0);textSize(16);drawString("Winner Number: "+winnerNumber,-1.5,0)}if(winnerColor==="black"){fill(0,0,0);textSize(16);drawString("Winner Number: "+winnerNumber,-1.5,0)}};var countColor=function(){if(winnerColor==="red"){numberOfReds++}if(winnerColor==="black"){numberOfBlacks++}if(winnerColor==="green"){numberOfGreens++}};var ballAction=function(dt){var intervalTime=4;var friction=.5;if(state===0){textSize(20);fill(0,64,255);drawString("Place your bets!!",-1.6,4);time+=dt;if(time>intervalTime){state=1;time=0}ballPos=0;ballVel=random(10,42);drawBall();drawButtons()}else if(state===1){ballVel+=-friction*ballVel*dt;ballPos+=ballVel*dt+.5*(-friction*ballVel)*dt*dt;fill(0,0,0);drawBall();if(Math.abs(ballVel)<=.6){state=2;if(redButtonPressed||blackButtonPressed){myMoney-=bet}}}else if(state===2){var omega=1;ballPos+=omega*dt;fill(0,0,0);drawBall();var index=findWinnerIndex();winnerNumber=numbers[index];winnerColor=numbersColor[index];time+=dt;drawWinLose();if(time>intervalTime){state=3;time=0}}else if(state===3){if(checkIfWin()){myMoney+=2*bet}else if(myMoney===0){isLose=true}countColor();resetButtons();state=0;myColor="none";bet=0}};var euler=function(dt){var omega=1;tablePhase+=omega*dt;drawRoullete(tablePhase,3.5);ballAction(dt)};var loseMsg=function(){if(isLose){fill(0,0,0);textSize(30);drawString("YOU LOSE",-1.8,.9);drawString("Click to restart",-2.1,-.9)}if(mouseIsPressed&&isLose){myMoney=10;isLose=false}};var drawHist=function(){var total=numberOfReds+numberOfBlacks+numberOfGreens;var redRatio=numberOfReds/total;var blackRatio=numberOfBlacks/total;var maxHeight=1;fill(255,0,0);drawRect(3.8,-4.5,.1,maxHeight*redRatio);fill(0,0,0);drawRect(4.5,-4.5,.1,maxHeight*blackRatio);textSize(8);drawString(numberOfReds,3.6,-4.5+maxHeight*redRatio);drawString(numberOfBlacks,4.3,-4.5+maxHeight*blackRatio)};var draw=function(){background(255,255,255);currentTime=millis()*.001;var dt=currentTime-oldTime;oldTime=currentTime;fill(255,170,0);textSize(20);drawString("Money: "+myMoney+"$",-4.8,4.2);fill(0,13,255);textSize(20);drawString("Bet: "+bet+"$",-4.8,3.6);euler(dt);drawHist();loseMsg()};init()}if(typeof draw!=="undefined")processing.draw=draw});
</script></span></p></article>
Loading

0 comments on commit cf87793

Please sign in to comment.