Skip to content

Fix issues with dataset unit-tests failing between frameworks #556

Description

@IsakNaslundBh

Description:

The datadriven tests described here:

https://bhom.xyz/documentation/Guides-and-Tutorials/Coding-with-BHoM/Testing/Data-Driven-Tests/

Are for some cases failing when going between running in netframework and net5 or above.

This is due to the exact matching of doubles, comparing them to serialised values. This issue is coming from the fact that the double.ToString() method was updated in net Core 3.0:

https://devblogs.microsoft.com/dotnet/floating-point-parsing-and-formatting-improvements-in-net-core-3-0/

What happends is, essentailly, that some numbers gets de-serialised to a slightly different value when deserialised in newer frameworks compared to old, leading to a failure in the comparison.

THis is increasingly urgent to fix with the roleout of the new github actions CI checks (running on new net) compared to the BHoMBot running on net framework.

Steps to reproduce:

See:

https://github.com/BHoM/BHoM_Engine/actions/runs/34324837056/job/102379594090

You can run those tests locally in newer runtimes (like rhino 8) which should give you the same results.

Expected behaviour:

For unit-tests created in framework to still pass when run on net >5 and vice versa.

First thing to try to remedy is to lower the amount of significant figures that are checked for. Going with a fixed tolerance based approach will not work as the magnitude of the numbers are unknown (for some cases you might want to compare numbers in e-10 range, and sometimes in the e10 range).

Checking against significant figures might solve a bulk of the problems.

If any more issues presists, such as doubles turned to strings in the resulting value, we might simply need to slightly change/remove those tests,

Test file(s):

and have some way to ensure that all tests added are able to pass in both framework and net.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugError or unexpected behaviour

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions