Last active
April 12, 2018 18:17
-
-
Save alexglazkov9/8a66907939cedf0e5365fe736210a919 to your computer and use it in GitHub Desktop.
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 (C) 2015 Aleksey Glazkov. All rights reserved. | |
// This code is governed by the BSD license found in the LICENSE file. | |
/*--- | |
info: Array.prototype.reverse() rearranges elements array so as to reverse their order. | |
description: Checking returned results. | |
---*/ | |
var arr = []; | |
var original = arr; | |
var reversed = arr.reverse(); | |
////////////////////////////////////////////////////////////////////////////// | |
//CHECK#1 | |
assert.sameValue(original, reversed, "Values are not the same!"); | |
// | |
////////////////////////////////////////////////////////////////////////////// | |
arr.push(1); | |
original = arr; | |
reversed = arr.reverse(); | |
////////////////////////////////////////////////////////////////////////////// | |
//CHECK#2 | |
assert.sameValue(original, reversed, "Values are not the same!"); | |
// | |
////////////////////////////////////////////////////////////////////////////// | |
arr.push(1); | |
original = arr; | |
reversed = arr.reverse(); | |
////////////////////////////////////////////////////////////////////////////// | |
//CHECK#3 | |
assert.sameValue(original, reversed, "Values are not the same!"); | |
// | |
////////////////////////////////////////////////////////////////////////////// | |
arr = new Array(1,2,3); | |
reversed = arr.reverse(); | |
////////////////////////////////////////////////////////////////////////////// | |
//CHECK#4 | |
assert(compareArray(reversed, [3,2,1]), "Arrays do not match!"); | |
// | |
////////////////////////////////////////////////////////////////////////////// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment