Skip to content

Using tests from “Violet - Python VM written in Swift” #98

@LiarPrincess

Description

@LiarPrincess

Hi,

As I mentioned in #97 Using ManagedBufferPointer instead of Array as a storage I also implemented my own version of BigInt for Violet - Python VM written in Swift.

The question is: can I merge some of our tests to this repo?

The main idea behind this would be to test our tests. If attaswift/BigInt fails some case then it may mean that the test is wrong, in which case we have to fix our code in Violet.

Violet test suite is quite big (but by no means it is exhausting the test-space). We went with property based testing with means that we test millions of inputs to check if the general rule holds (for example: a+b=c -> c-a=b etc.). This takes time, but pays for itself by finding weird overflows in bit operations (we store “sign + magnitude”, so bit operations are a bit difficult to implement).

You can preview our tests at Violet -> BigIntTests. Though I would advise reading our documentation before, because our design is quite different than yours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions