Skip to content

Conversation

hazzik
Copy link
Member

@hazzik hazzik commented May 14, 2018

  • Also fix CollectionHelper.GetHashCode to account for the length of the collections

This is an alternative implementation to #1613

@hazzik hazzik requested a review from fredericDelaporte May 14, 2018 23:43
- Also fix CollectionHelper.GetHashCode to account for the length of the collections
@@ -205,18 +205,5 @@ public void NativeSQLQuerySpecificationInequalityOnSpaceLengthes()
Assert.IsFalse(spec1.Equals(spec2));
Assert.IsFalse(spec2.Equals(spec1));
}

[Test]
public void NativeSQLQuerySpecificationInequalityOnSpaceOrderings()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is removed because.... the hash set does not guarantee the ordering.

Copy link
Member

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new overload lacks tests. Tests similar to these tests should be added.

@fredericDelaporte
Copy link
Member

NamedParameterComparer remains not fully tested (not checking hashcode are better with it), but testing it would be easier done with #1612 fixes of QueryKey/FilterKey tests.

Is.EqualTo(CollectionHelper.GetHashCode(d2, KvpStringComparer.Instance)));
}

// Failure of following tests is not an error from GetHashCode semantic viewpoint, but it causes it
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to replace asserts with warnings then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trouble with such warnings is that their failures will likely be unnoticed. A test that may just generate warnings without having any assert does no good in my opinion.

Even if the GetHashCode semantics allows collision, having collisions on simple and recurring cases is a bad thing and is worth a failing test case in my opinion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NUnit’s warnings mark tests as inconclusive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but who checks inconclusive tests? If the build does not fail, a PR causing a regression on this point is very likely to not be rejected due to causing that regression, because it will likely goes unnoticed.

@hazzik hazzik merged commit 8d14aad into nhibernate:master May 15, 2018
@hazzik hazzik deleted the GetHashCode branch May 16, 2018 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants