Skip to main content
Filter by
Sorted by
Tagged with
9 votes
1 answer
615 views

I noticed a discrepancy between C++23 and C++26 code when using googlemock: enum A { A1, A2 }; enum B { B1, B2 }; TEST(...) { ASSERT_EQ(A1, B1); // compiles fine in C++23 and C++26 ASSERT_THAT(...
PiotrNycz's user avatar
  • 25.1k
Advice
0 votes
4 replies
126 views

In Haskell, how should one test the equality of two infinite lists? With finite lists, one might try: listEqual :: Eq a => [a] -> [a] -> Bool listEqual l0 l1 = and $ zipWith (==) l0 l1 But ...
Geoffrey Warne's user avatar
Tooling
0 votes
2 replies
59 views

I am using optional chaining quite often, but so far never encounter that issue, until today: if both items can be undefined, rather don't use optional chaining. Only last test (below) can help in ...
allez l'OM's user avatar
0 votes
1 answer
102 views

I'm in a .NET 6 web application with EFCore, and I have these boilerplate abstract classes and interfaces for defining entities. I know it's quite a number of complexity layers, but it really helps me ...
Davide Vitali's user avatar
3 votes
2 answers
273 views

So, I am learning C language and was trying to make a function that returns the length of a string. In the if statement I mistakenly used "" instead of ''. So, instead of comparing to char '\...
Schrey's user avatar
  • 69
0 votes
3 answers
97 views

take the code below: contentsDiv.innerHTML = container.outerHTML; if(contentsDiv.firstChild === container) console.log('true'); in this code, contentsDiv is a div created in my html file ...
Miachi Solomon's user avatar
1 vote
1 answer
165 views

struct Equal { friend bool operator==(const Equal&, const Equal&); }; struct Unequal { friend bool operator!=(const Unequal&, const Unequal&); }; int main() { Equal{} == ...
Denis's user avatar
  • 3,174
-1 votes
3 answers
299 views

The Equals and GetHashCode methods on anonymous types are overridden to make them work in such a way that two instances of the same anonymous type are considered equal only if all their properties are ...
Sisus's user avatar
  • 750
1 vote
1 answer
181 views

I have an array: let mut zobrist_pieces = [[0u64; 64]; 12]; for i in 0..12 { for j in 0..64 { zobrist_pieces[i][j] = rng.random(); } } and I want to check if there is any way to find ...
theKMan747's user avatar
0 votes
1 answer
78 views

I am wondering if, and if so which guarantees there are about the pickle module when using pickle.dump[s]. Specifically for my problem I am pickling list[T] where T can be bool, int, decimal, time, ...
JoniKauf's user avatar
  • 346
0 votes
2 answers
96 views

I'm writing some testcases for a program using the GLib testing facilities. I want to assert that two floats have the same value, and g_assert_cmpfloat () seemed like an appropriate function for that. ...
Newbyte's user avatar
  • 3,955
1 vote
4 answers
134 views

I have a custom class for holding a collection of quotes in swiftData in my app. It looks like this: @Model final class CollectionData: Equatable { var name: String var data: [Quote] var ...
Kitten Apps-Films's user avatar
0 votes
0 answers
96 views

I am looking for the way how to compare two files (especially large files) in S3 within the same bucket using Java AWS SDK. I do not need to verify whole bucket if there are duplicates. As I ...
Bronek Kristal's user avatar
0 votes
2 answers
105 views

I have two classes, non-generic BindingFilter and generic BindingFilter<T>: public class BindingFilter { public object Value { get; set; } public string Member { get; set; } ...
dgo's user avatar
  • 3,987
3 votes
1 answer
275 views

Why is this code ambiguous starting with C++20? template <typename T> struct base_widget { bool operator==(T const&) const; }; struct gadget : base_widget<gadget> {}; bool foo(...
Jaka's user avatar
  • 1,241
0 votes
0 answers
44 views

I have a custom dataclass, which is rather lage (many attributes, methods). Some attributes are pandas dataframes. The default __eq__ comparison does not work for the attribtues which are pandas ...
user13132640's user avatar
0 votes
3 answers
112 views

I am just starting to study Dart and a question arose, a clear answer to which I could not find or formulate for myself. I'm trying to figure out the difference between == and identity(). Using the ...
JuliaSvygina's user avatar
0 votes
1 answer
108 views

I would like to test if the coefficients across different regressions are the same in R and I am not sure how I should do it. Let me illustrate. I have an independent variable of interest called treat ...
Alex's user avatar
  • 1,304
0 votes
1 answer
73 views

Here is a minimum (not-)working example. infix 4 _≡_ data _≡_ {a} {A : Set a} (x : A) : A → Set a where refl : x ≡ x {-# BUILTIN EQUALITY _≡_ #-} data Type₁ : Set where id : Type₁ non-id ...
William Angus's user avatar
0 votes
2 answers
216 views

This might be a beginners question, but I have a problem for which I could not find an existing solution and was hoping you could help me here. I would like to compare instances of a reference type ...
notSoSharpAskingAboutcSharp's user avatar
1 vote
2 answers
46 views

I don't understand the following situation: let a1: [[Double]] = [[1]] let equ1 = a1 == a1 // This builds let t1: (Double, Double) = (1, 1) let equ2 = t1 == t1 // This builds also let a2: [[(Double, ...
Reinhard Männer's user avatar
0 votes
1 answer
93 views

I am working on a kotlin function that needs to verify that all objects in a collection have the same value for a particular property. Normally I would simply use distinctBy() and check that the size ...
pbuchheit's user avatar
  • 1,839
1 vote
1 answer
75 views

While debugging my implementation of YMODEM on an embedded system, I noticed that some code comparing a uint8_t and the inverse of a uint8_t is not behaving as I expected, but I don't really ...
9a3eedi's user avatar
  • 728
3 votes
1 answer
510 views

Consider this Minimal Reproducible Example. Point point1 = new Point(1, 2, 3); Point point2 = new Point(1, 2, 31); Console.WriteLine(point1 == point2); // True Console.WriteLine(point1.Equals(point2)...
FluidMechanics Potential Flows's user avatar
1 vote
1 answer
107 views

Assume I have some complex class structure with some hierarchy, public and private fields. I need to do some custom serialization for such class. In some test after deserialize I want to compare ...
Anton's user avatar
  • 93
1 vote
2 answers
424 views

I'm interested in the most efficient way to check for equality of memory blocks. Currently, I use memcmp(...) == 0 to determine if two memory blocks are equal. While this works, memcmp is designed not ...
AvidCoder's user avatar
  • 531
0 votes
0 answers
100 views

I know that the laws for the Eq class include reflectivity, symmetry, and transitivity. Is there another class for the case where equality is not necessarily transitive? I could write one myself (see ...
rprospero's user avatar
  • 1,023
-3 votes
3 answers
2k views

What's the best way to compare two lists of string in terraform? ["arm64"] == ["arm64"] evaluates to false My use case is constructing lambda extension ARNs based on ...
Croad Langshan's user avatar
0 votes
1 answer
87 views

I am testing the eshop. I'm trying to verify that if you buy one product, the price will be the same as the final purchase price. The first element "Final Price" is calculated by the price ...
Jane.'s user avatar
  • 3
3 votes
3 answers
248 views

When trying to construct an example where a == b is not the same as b == a, it seems that I have accidentally constructed an example where a == b is not the same as a.__eq__(b): class A: def ...
Sebastian Thomas's user avatar
2 votes
3 answers
338 views

I'm looking for an implementation of hash code to use alongside IReadOnlySet<T>.SetEquals. .NET's HashCode type appears to be order sensitive, so it is not a good fit. var random = new Random(); ...
Kyle McClellan's user avatar
3 votes
1 answer
377 views

What's the correct way to compare hashtables in Pester tests? i.e. the following gives the error: InvalidResult: Expected System.Collections.Hashtable, but got System.Collections.Hashtable. $expected =...
JohnLBevan's user avatar
  • 24.8k
-4 votes
1 answer
151 views

How do Java's equality tests work between primitives? I'm specifically looking for efficiency (and speed) within single-type comparisons. Is the char == char comparison faster than int == int? I ...
Eliezer Meth's user avatar
8 votes
1 answer
343 views

In (an idealized version of) Haskell, is there a concrete type a such that we can implement Eq a lawfully, but it is impossible to implement Ord a? The order doesn't need to be meaningful, and any ...
Trebor's user avatar
  • 431
0 votes
2 answers
112 views

I am using C# records in a HashSet to enforce uniqueness. This works well, but as soon as the record contains a Collection then it stops working. ie. this passes: public record Person { public ...
mulllhausen's user avatar
  • 4,475
0 votes
1 answer
78 views

I have the past 19 days of stock price stored in the pd.dataframe and I am trying to find out the price P that is smaller than (mean - 2.5*standard deviation), where mean and standard deviation are ...
Roy Chang's user avatar
0 votes
2 answers
135 views

I wanna compare two literal strings using expr command in Tcl. The correct command is: expr {"string1" == "string1"} In my understanding, curly braces in Tcl is used to prevent ...
zzzhhh's user avatar
  • 73
1 vote
1 answer
159 views

i have a question why it works like this var a = new Tuple<object, object, object>(1, 1, 1); var b = new Tuple<object, object, object>(1, 1, 1); Console.WriteLine(a.Item1==b.Item1);//...
Кирилл Гелашвили's user avatar
2 votes
1 answer
764 views

As mentioned here: Efficient way to compare an partition two collections in Kotlin I am working on a Kotlin application that needs to compare lists of Json objects. To find the elements that are ...
pbuchheit's user avatar
  • 1,839
0 votes
1 answer
117 views

Code: #include<stdio.h> #include<stdlib.h> unsigned char s(const unsigned char x) { static const unsigned char aes_s_box[16][16] = { {0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F,...
kesarling's user avatar
  • 2,318
1 vote
2 answers
78 views

Attach TestMono to an empty GameObject, leave the serialized field uov empty and play. The result is not what I expected. using System; using UnityEngine; using Object = UnityEngine.Object; namespace ...
Hailin Li's user avatar
0 votes
2 answers
233 views

If we have a class that contains properties/fields of other reference types, how would a proper and elegant equality check be performed? For example, MainClass contains properties of SubClassA and ...
Tsaras's user avatar
  • 493
0 votes
0 answers
29 views

I am new to Rust & I am having trouble to compare mutable strings and immutable strings. Please find below a code block which should exit if "exit" is entered. But I am having problem ...
Snehangshu Bhusan Pal's user avatar
1 vote
0 answers
31 views

I am filtering using AngularJS. Everything works fine, but I want a filter to work differently. If "1" is searched, the result should only be "1". I would like your help regarding ...
CodeInSpace's user avatar
4 votes
2 answers
403 views

I'm currently learning Kotlin and encountered a behavior that I find puzzling. Here are the two lines of code that have me confused: "".equals(1) // not compile error "" == 1 // ...
ho ya's user avatar
  • 43
-2 votes
1 answer
62 views

I wrote this code to ask the user for options A, B, or C and show a message afterward, but even if I type the correct options, it still sends me the 'try again' message. what can I do so the program ...
Carlos De Avila's user avatar
1 vote
2 answers
320 views

I am trying to compare the following two characters l and ł and get c# to return true i.e. I have the word Przesyłka and would like to do a string comparison to Przesylka I have tried the following ...
JKennedy's user avatar
  • 18.9k
1 vote
0 answers
55 views

In MATLAB R2016a, suppose that I define the array arr = -0.2:0.1:0.2. I may then find the location of the value el = 0.1 with the command idx = find(arr==el). This correctly yields idx = 4. But now ...
SapereAude's user avatar
2 votes
3 answers
6k views

I would like to know if there is a better way to compare objects in JavaScript. I understand that there are many large solutions but I would like to get a clear answer if their is a simple way to do ...
Chris's user avatar
  • 924
2 votes
0 answers
63 views

In the following example (my attempt to mimic section feature of LEAN4 prover), I have declared 2 special axioms that allows 2 objects of type Gen[T] to be perceived equal and can be cast to each ...
tribbloid's user avatar
  • 3,822

1
2 3 4 5
46