Questions tagged [deepequals]

If this tag is used for Java 7's `deepEquals` function which provides comparison for objects or arrays of objects across properties, please also use the [java-7] or [java] tags. Otherwise, this tag may be used for any sort of operator in any language that compares objects and takes their properties into account.

If this tag is used for Java 7's deepEquals function which provides comparison for objects or arrays of objects across properties, please also use the [java-7] or [java] tags. Otherwise, this tag may be used for any sort of operator in any language that compares objects and takes their properties into account.

For reference: Java 7's Object deepEquals() and Array deepEquals() functions.

30 questions
1
vote
1 answer

JS function "Deep comparison". Object comparison

I wanted to implement JS function "Deep comparison" and encounter on one interesting feature. 1st case - var arrValuesObjA = [{is: "an"}, 2]; var arrValuesObjB = [{is: "an"}, 2]; console.log(Array.isArray(arrValuesObjA),…
Yellowfun
  • 418
  • 1
  • 9
  • 21
1
vote
1 answer

Are arrays and objects with numeric properties equal in javascript?

Can someone explain to me why the following is true: let foo = { A: [ 1, 2 ] } let bar = { "A": { "0": "1", "1": "2" } } assert.deepEqual(foo, bar);
OscarRyz
  • 196,001
  • 113
  • 385
  • 569
1
vote
1 answer

Arrays.deepEquals returning false on 2 identical arrays

I have a code import java.util.*; import java.io.*; public class Dijkstra { public static int [][] Dijkstra_alg( int n, int e, int mat[][], int s) { s=s-1; int adj[][]=new int[n][n]; for(int…
Rohil
  • 177
  • 1
  • 3
  • 13
1
vote
1 answer

strange new Date in deepEqual

I have this code var assert = require('assert'); describe('date', function() { it('deep equal', function() { assert.deepEqual({date: ''}, {date:new Date()}); }); }); when I run the test with mocha I get this AssertionError: { date: '' }…
JuanPablo
  • 23,792
  • 39
  • 118
  • 164
1
vote
3 answers

Function checking for "deep equality" of nested objects

I am trying to write a function that checks if two objects have the same values. This function requires that I check for the equality of any objects that are stored as values inside the original objects. The approach I have developed (see code…
benpiggot
  • 143
  • 2
  • 9
1
vote
1 answer

LINQ & XNode.DeepEquals running comparisons twice?

I'm using LINQ to compare two XML documents. If a difference is found between two elements I add those nodes to a list which I use to generate a report of differences. The 'problem' is that if a difference is found it is added to the list twice.…
0
votes
1 answer

expect(received).toEqual(expected) // deep equality error Jest unit testing

I am doing unit testing with Jest and got the error in user.controller.spec.ts file. Other files got passed. Old error: PASS src/app.controller.spec.ts (10.482 s) PASS src/users/services/users.service.spec.ts (11.629 s) FAIL …
thi_m
  • 9
  • 5
0
votes
1 answer

Override deepEquals() method in Java without using Java.util.* method

There is something wrong with the deepEquals method in my ArrayDeque file, but I can not figure it out. It should also make sense for LinkedListArrayDeque. How to make the deepEquals work without using Java.util.* method? The code below is about a…
zixuan zhu
  • 15
  • 4
0
votes
0 answers

Why doesn't the deepEqual method work on this code?

I was looking at codes on stack overflow and I bumped into a problem that included this piece of code: var obj = {here: 2}; console.log(deepEqual(obj, obj)); // → true console.log(deepEqual(obj, {here: 1})); // → false console.log(deepEqual(obj,…
Heny
  • 13
  • 1
0
votes
1 answer

How to deep compare maps to filter distinct items in XQuery?

I wish I could filter a list of maps to remove those that are identical. The union operator of XQuery only works on nodes. The How can I do a deep comparison of maps to output distinct maps ? I can suppose that the function deep-equal() could be…
emchateau
  • 65
  • 7
0
votes
1 answer

Error comparing arrays using deepEqual. What is my mistake and why?

Can't find why it runs a deepEqual error, and unfortunately I only have this partial error log file. (The test code is not mine). Statement: We want to write a function suitTrue, which given a suit, returns a list of strings, one for each card of…
0
votes
3 answers

AssertJ multidimensional arrays assertion (deep equals)

Is there any option in AssertJ to make deep assertion of 2-d (N-d) arrays? Pretty much the same as java.util.Arrays#deepEquals() does but with assertion exception and prettified fail message like "element arr1[i][j] expected to be X, but was Y" Here…
radistao
  • 14,889
  • 11
  • 66
  • 92
0
votes
2 answers

Testing Cookie returned from Function in Go

I am attempting to test a function that retrieves a Cookie from a request in Go however even though they have the same value, the comparison fails. package main import ( "fmt" "log" "net/http" "net/http/httptest" …
Alexandre Thenorio
  • 2,288
  • 3
  • 31
  • 50
0
votes
2 answers

Comparing equals between 1D and 2D array in java

I have two questions: I am using JAVA programming language and I have found some difficulties using Arrays. Here are some different arrays : Object [] play1 = {0,3,6}; Object [] play2 = {0,3,6,4}; Object[][] pre =…
user1946440
  • 349
  • 1
  • 5
  • 13
0
votes
2 answers

equals / Arrays.deepequals returns false on identical arrays

I'm trying to test if two arrays are identical, I printed out every values inside them and you can see that those values are the same but for some reason the equality test always returns false. I've tried using equals as well as Arrays.deepEquals…
noisegrrrl
  • 149
  • 1
  • 13
1
2