Skip to content

Instantly share code, notes, and snippets.

@pranoy10
Created March 15, 2018 04:29
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 pranoy10/10fd4bbf04a7490567d527017c8d52df to your computer and use it in GitHub Desktop.
Save pranoy10/10fd4bbf04a7490567d527017c8d52df to your computer and use it in GitHub Desktop.
Lab4 Testing
// 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