question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Comparing sequences fails

See original GitHub issue

Description

The following fails:

Seq.init 100 ((+) 1)
|> should equal (Seq.init 100 ((+) 1))

Repro steps

See above.

Expected behavior

Should succeed.

Actual behavior

Gives test error:

FsUnit.Xunit+MatchException : Exception of type 'FsUnit.Xunit+MatchException' was thrown.
Expected: Equals seq [1; 2; 3; 4; ...]
Actual:   seq [1; 2; 3; 4; ...]

Which is rather confusing as it doesn’t show where the two sequences diverge (spoiler alert: they don’t 😉 ).

Known workarounds

A workaround is to not use sequences in tests

I.e.: turning them into eager collections works fine:

Seq.init 100 ((+) 1)
|> Array.ofSeq
|> should equal (Seq.init 100 ((+) 1) |> Array.ofSeq)

Related information

Version 5.0.5 Using: FsUnit.Xunit

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
abelbraaksmacommented, Nov 1, 2022

I was counting on that, otherwise why add it, right?

1reaction
CaptnCodrcommented, Oct 30, 2022

You are not the only one who needs/needed this. 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does the comparison test fail here?
My conclusion is that the proposed inequality is actually false and so the direct comparison test cannot be applied, but the x must...
Read more >
Comparative analyses of error handling strategies for next- ...
In the current study, we analyzed the effect of sequencing errors on diagnostic tests as well as the different error handling strategies. We ......
Read more >
Interpreting alignment-free sequence comparison
The output from an alignment-free sequence comparison is a similarity score, the interpretation of which is not straightforward.
Read more >
Finding errors in DNA sequences. - PMC
If the coding sequence shows similarity to a known protein sequence then such errors can be detected by comparing the conceptual translations of...
Read more >
Sequencing error profiles of Illumina sequencing instruments
Comparing the error rates of sequencing platforms has been a focus of research since sequencing began. Every new platform has its advantages ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found