9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 4906359 6239296
27 * @summary Basic test for content-based array object methods
28 * @author Josh Bloch, Martin Buchholz
29 */
30
31 import java.util.*;
32 import java.io.*;
33
34 public class ArrayObjectMethods {
35 int[] sizes = {0, 10, 100, 200, 1000};
36
37 void test(String[] args) throws Throwable {
38 equal(Arrays.deepToString(null), "null");
39 equal(Arrays.deepToString(new Object[]{}), "[]");
40 equal(Arrays.deepToString(new Object[]{null}), "[null]");
41 equal(Arrays.deepToString(new Object[]{null, 1}), "[null, 1]");
42 equal(Arrays.deepToString(new Object[]{1, null}), "[1, null]");
43 equal(Arrays.deepToString(new Object[]{new Object[]{}, null}), "[[], null]");
44
45 {
46 Object[] a = {1, null};
47 a[1] = a;
48 equal(Arrays.deepToString(a), "[1, [...]]");
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 4906359 6239296
27 * @summary Basic test for content-based array object methods
28 * @author Josh Bloch, Martin Buchholz
29 * @key randomness
30 */
31
32 import java.util.*;
33 import java.io.*;
34
35 public class ArrayObjectMethods {
36 int[] sizes = {0, 10, 100, 200, 1000};
37
38 void test(String[] args) throws Throwable {
39 equal(Arrays.deepToString(null), "null");
40 equal(Arrays.deepToString(new Object[]{}), "[]");
41 equal(Arrays.deepToString(new Object[]{null}), "[null]");
42 equal(Arrays.deepToString(new Object[]{null, 1}), "[null, 1]");
43 equal(Arrays.deepToString(new Object[]{1, null}), "[1, null]");
44 equal(Arrays.deepToString(new Object[]{new Object[]{}, null}), "[[], null]");
45
46 {
47 Object[] a = {1, null};
48 a[1] = a;
49 equal(Arrays.deepToString(a), "[1, [...]]");
|