c# - Text fixture setup failed on huge array -
c# - Text fixture setup failed on huge array -
i'm trying test method overflow error described here. reason running test fails error "testfixturesetup failed". wrong initializing array using int[int.maxvalue]
. can explain how prepare this?
[testfixture ()] public class findrecursivetest { int[] overflowarray = new int[int.maxvalue]; [test ()] public void testoverflow () { int[] array = overflowarray; int searchnumber = int.maxvalue; assert.areequal(-1, binarysearcher.findrecursive(searchnumber, array, 0,array.length - 1), "key 0"); }
the class initializer throwing outofmemoryexception
when initializing overflowarray
. there's no way around know of, since maximum size of object in .net 2gb
starting .net 4.5 can create arrays of sizes larger 2gb setting gcallowverylargeobjects
setting, size limit still applies other objects.
c# xamarin nunit
Comments
Post a Comment