test/script/basic/JDK-8080182.js

Tue, 21 Mar 2017 13:41:57 -0700

author
asaha
date
Tue, 21 Mar 2017 13:41:57 -0700
changeset 2160
1df40fe54cd6
parent 1482
58791cd01bc9
permissions
-rw-r--r--

Merge

sundar@1349 1 /*
sundar@1482 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
sundar@1349 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
sundar@1482 4 *
sundar@1349 5 * This code is free software; you can redistribute it and/or modify it
sundar@1349 6 * under the terms of the GNU General Public License version 2 only, as
sundar@1349 7 * published by the Free Software Foundation.
sundar@1482 8 *
sundar@1349 9 * This code is distributed in the hope that it will be useful, but WITHOUT
sundar@1349 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
sundar@1349 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
sundar@1349 12 * version 2 for more details (a copy is included in the LICENSE file that
sundar@1349 13 * accompanied this code).
sundar@1482 14 *
sundar@1349 15 * You should have received a copy of the GNU General Public License version
sundar@1349 16 * 2 along with this work; if not, write to the Free Software Foundation,
sundar@1349 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
sundar@1482 18 *
sundar@1349 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
sundar@1349 20 * or visit www.oracle.com if you need additional information or have any
sundar@1349 21 * questions.
sundar@1349 22 */
sundar@1349 23
sundar@1349 24 /**
sundar@1349 25 * JDK-8080182: Array.prototype.sort throws IAE on inconsistent comparison
sundar@1349 26 *
sundar@1349 27 * @test
sundar@1349 28 * @run
sundar@1349 29 */
sundar@1349 30
sundar@1349 31 function Random() {
sundar@1349 32 this.toString = function() {
sundar@1349 33 return (Math.random() * 100).toString();
sundar@1349 34 }
sundar@1349 35 }
sundar@1349 36
sundar@1349 37 for (var i = 0; i < 100; ++i) {
sundar@1349 38 var arr = [];
sundar@1349 39
sundar@1349 40 for (var j = 0; j < 64; ++j) {
sundar@1349 41 arr[j] = new Random();
sundar@1349 42 }
sundar@1349 43
sundar@1349 44 // no IllegalArgumentException expected!
sundar@1349 45 arr.sort();
sundar@1349 46 }

mercurial