maputil.js revision 877:cf4d2252d444
1193323Sed/*
2193323Sed * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
3193323Sed * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4193323Sed *
5193323Sed * This code is free software; you can redistribute it and/or modify it
6193323Sed * under the terms of the GNU General Public License version 2 only, as
7193323Sed * published by the Free Software Foundation.
8193323Sed *
9193323Sed * This code is distributed in the hope that it will be useful, but WITHOUT
10193323Sed * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11193323Sed * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12193323Sed * version 2 for more details (a copy is included in the LICENSE file that
13193323Sed * accompanied this code).
14193323Sed *
15193323Sed * You should have received a copy of the GNU General Public License version
16193323Sed * 2 along with this work; if not, write to the Free Software Foundation,
17193323Sed * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18193323Sed *
19249423Sdim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20249423Sdim * or visit www.oracle.com if you need additional information or have any
21193323Sed * questions.
22193323Sed */
23193323Sed
24193323Sed/**
25193323Sed * @subtest
26198090Srdivacky */
27198090Srdivacky
28198090Srdivackyfunction assertSameMap(obj1, obj2, msg) {
29198090Srdivacky    if (! Debug.identical(Debug.map(obj1), Debug.map(obj2))) {
30198090Srdivacky        fail(obj1.constructor + " instances don't share map " + Debug.diffPropertyMaps(Debug.map(obj1), Debug.map(obj2)));
31198090Srdivacky    }
32198090Srdivacky}
33198090Srdivacky
34212904Sdimfunction assertNotSameMap(obj1, obj2, msg) {
35193323Sed    if (Debug.identical(Debug.map(obj1), Debug.map(obj2))) {
36193323Sed        fail(obj1.constructor + " and " + obj2.constructor + " instances share map");
37193323Sed    }
38193323Sed}
39193323Sed
40193323Sedfunction assertEqualWithoutTypeMap(obj1, obj2, msg) {
41198090Srdivacky    if (!Debug.equalWithoutType(Debug.map(obj1), Debug.map(obj2))) {
42198090Srdivacky        fail(obj1.constructor + " and " + obj2.constructor + " instances don't have identical (without considering property types) maps");
43198090Srdivacky    }
44198090Srdivacky}
45198090Srdivacky