Skip to content

Denormalized Signed tests #101

@oscbyspro

Description

@oscbyspro

While I'm at it, I think it would be wise to test for 'denormalized' Signed<Magnitude> equality, as opposed to 'normalized' equality. The difference being that Signed<Magnitude> treats positive and negative zero as 'equal' in the Equatable sense. There may be situations where these values are differentiated. I'm considering replacing XCTAssertEqual with:

func ANKAssertIdentical<T>(_ lhs: ANKSigned<T>, _ rhs: ANKSigned<T>, file: StaticString = #file, line: UInt = #line) {
    let success: Bool = lhs.sign == rhs.sign && lhs.magnitude == rhs.magnitude
    XCTAssert(success, "(\(lhs.sign)\(lhs.magnitude)) is not identical to (\(rhs.sign)\(rhs.magnitude))", file: file, line: line)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    brrrsuch code, much wow

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions