Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

GetHashCode Nrunch vs Nunit different values
supertom44
#1 Posted : Tuesday, April 15, 2014 11:59:47 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/15/2014(UTC)
Posts: 2
Location: United Kingdom

Hi all,

I am currently evaluating Ncrunch to see if it is a viable solution for my needs and I have come across a strange problem.

When requesting the hashcode of a string Ncrunch returns a different value in the test when compared to running the test in Nunit/ReSharper itself.

Here is an example of a test that fails with Ncrunch but passes with Nunit:

Quote:
[Test]
public void Test()
{
Assert.That(1099313834, Is.EqualTo("abc".GetHashCode()));
}


We are running:
ReSharper: 5.1 (NUnit version 2.5.7)
Ncrunch: 2.5.0.12
Standalone NUnit: 2.6.2
.Net 4 Framework

Cheers
Remco
#2 Posted : Tuesday, April 15, 2014 10:21:40 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi,

Thanks for posting. This is most likely due to a different in the processor architecture of the hosting process. There is a lack of standardisation around X86/X64 between test runners - please read this documentation page for more information. You can confirm whether the issue is X86/X64 based by comparing IntPtr.Size between test runs.
supertom44
#3 Posted : Thursday, April 17, 2014 9:52:30 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/15/2014(UTC)
Posts: 2
Location: United Kingdom

Hi,

Many thanks for your reply, IntPtr.Size does indeed differ between the two, I get 8 with ReSharper and 4 with NCrunch.

We have read the article you linked us to and we have tried changing the architecture but we are still unable to solve this issue.
Remco
#4 Posted : Thursday, April 17, 2014 1:02:31 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi,

It seems as though your test project has been designed to only work with an X64 architecture.

So to me it makes sense for you to change the processor architecture in the build configuration for this project to X64. In this way, there's no way the project can be loaded in an X86 architecture. NCrunch will detect this and will run as X64.

Can you describe the problem you're experiencing right now? Does changing the architecture as you have done not have any effect on the process? (i.e. is it still launching as X86?)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.034 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download