Skip to content

Instantly share code, notes, and snippets.

@irrationalRock
Created March 12, 2018 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irrationalRock/362826160d1646f69d274a3e729d5bb0 to your computer and use it in GitHub Desktop.
Save irrationalRock/362826160d1646f69d274a3e729d5bb0 to your computer and use it in GitHub Desktop.
Reverse Tests
//CHECK#1
var x = [];
var reverse = x.reverse();
assert.sameValue(x,reverse,"#1: x = " + x + " ; x.reverse() = " + reverse );
//CHECK#2
x = [];
x[0] = 1;
var reverse = x.reverse();
assert.sameValue(x,reverse,"#2: x = " + x + " ; x.reverse() = " + reverse );
//CHECK#3
x = new Array(1,2);
var reverse = x.reverse();
assert.sameValue(x,reverse,"#3: x = " + x + " ; x.reverse() = " + reverse );
//CHECK#4
assert.sameValue(x[0],2,"#4: x = " + 1 + " ; x = " + x[0] );
//CHECK#5
assert.sameValue(x[1],1,"#5: x = " + 2 + " ; x.reverse() = " + x[1] );
//CHECK#6
assert.sameValue(x.length,2,"#6: x = " + 2 + " ; x.length = " + x.length );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment