Created
March 15, 2018 04:29
-
-
Save pranoy10/10fd4bbf04a7490567d527017c8d52df to your computer and use it in GitHub Desktop.
Lab4 Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2009 the Sputnik authors. All rights reserved. | |
// This code is governed by the BSD license found in the LICENSE file. | |
/*--- | |
info: array.reverse returns the reverse order of the provided array | |
description: Checking reverse cases. | |
---*/ | |
////////////////////////////////////////////////////////////////////////////// | |
//CHECK #1 | |
var x = []; | |
var reverse = x.reverse(); | |
assert.sameValue(x, reverse, "#1: x = []; x.reverse() === x. Actual: " + (reverse)); | |
// | |
////////////////////////////////////////////////////////////////////////////// | |
////////////////////////////////////////////////////////////////////////////// | |
//CHECK #2 | |
var x = []; | |
x[0] = 1; | |
var reverse = x.reverse(); | |
assert.sameValue(x, reverse, '#2: x = []; x[0] = 1; x.reverse() === x. Actual: ' + (reverse)); | |
// | |
////////////////////////////////////////////////////////////////////////////// | |
////////////////////////////////////////////////////////////////////////////// | |
//CHECK #3 | |
var x = new Array(1,2); | |
var reverse = x.reverse(); | |
assert.sameValue(x, reverse, '#3: x = new Array(1,2); x.reverse(). Actual: ' + (reverse)); | |
// | |
////////////////////////////////////////////////////////////////////////////// | |
////////////////////////////////////////////////////////////////////////////// | |
//CHECK #4 | |
assert.sameValue(x[0], 2, '#4: x = new Array(1,2); x.reverse(); x[0] === 2. Actual: ' + (x[0])); | |
// | |
////////////////////////////////////////////////////////////////////////////// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment