michael@0: load(libdir + "parallelarray-helpers.js"); michael@0: michael@0: // Test that we are able to compare numbers even if the typesets are michael@0: // not "clean" because we have previously added strings and numbers. michael@0: // Also test that we distinguish between bools/numbers etc for strict michael@0: // equality but not loose equality. michael@0: michael@0: function theTest() { michael@0: var ints = range(0, 1024); michael@0: var doubles = ints.map(v => v + 0.1); michael@0: var bools = ints.map(v => (v % 2) == 0); michael@0: var strings = ints.map(v => String(v)); michael@0: michael@0: function looselyCompareToDoubles(e, i) { michael@0: return doubles[i] == e; michael@0: } michael@0: print("doubles"); michael@0: assertArraySeqParResultsEq(doubles, "map", looselyCompareToDoubles); michael@0: print("bools"); michael@0: assertArraySeqParResultsEq(bools, "map", looselyCompareToDoubles); michael@0: // ion bails out when converting a string to a double right now, michael@0: // so par exec cannot proceed michael@0: print("strings"); michael@0: assertParallelExecWillBail(function (mode) { michael@0: strings.mapPar(looselyCompareToDoubles, mode) michael@0: }); michael@0: print("ints"); michael@0: assertArraySeqParResultsEq(ints, "map", looselyCompareToDoubles); michael@0: michael@0: function strictlyCompareToDoubles(e, i) { michael@0: return doubles[i] === e; michael@0: } michael@0: print("doubles, strict"); michael@0: assertArraySeqParResultsEq(doubles, "map", strictlyCompareToDoubles); michael@0: print("bools, strict"); michael@0: assertArraySeqParResultsEq(bools, "map", strictlyCompareToDoubles); michael@0: print("strings, strict"); michael@0: assertArraySeqParResultsEq(strings, "map", strictlyCompareToDoubles); michael@0: print("ints, strict"); michael@0: assertArraySeqParResultsEq(ints, "map", strictlyCompareToDoubles); michael@0: } michael@0: michael@0: if (getBuildConfiguration().parallelJS) michael@0: theTest();