public TestParameters(API api, StartIndexBase startIndexBase, int?startIndexOffset = null) { Api = api; StartIndexBase = startIndexBase; StartIndexOffset = startIndexOffset.HasValue ? startIndexOffset.Value : DEFAULT_STARTINDEXOFFSET; if (api == API.For64) { // StartIndexBase.Int64 was set to -1 since Enum can't take a Int64.MaxValue. Fixing this below. long indexBase64 = (startIndexBase == StartIndexBase.Int64) ? Int64.MaxValue : (long)startIndexBase; StartIndex64 = indexBase64 + StartIndexOffset; } else { // startIndexBase must not be StartIndexBase.Int64 StartIndex = (int)startIndexBase + StartIndexOffset; } WorkloadPattern = WorkloadPattern.Similar; // setting defaults. Count = 0; ChunkSize = -1; StateOption = ActionWithState.None; LocalOption = ActionWithLocal.None; ParallelOption = WithParallelOption.None; //partitioner options ParallelForeachDataSourceType = DataSourceType.Collection; PartitionerType = PartitionerType.IListBalancedOOB; }
public static void TestFor_Boundary(API api, StartIndexBase startIndexBase, int startIndexOffset, int count, WorkloadPattern workloadPattern) { var parameters = new TestParameters(api, startIndexBase, startIndexOffset) { Count = count, WorkloadPattern = workloadPattern, }; var test = new ParallelForTest(parameters); test.RealRun(); }
public static void ParrallelFor(API api, StartIndexBase startIndexBase, int count, WithParallelOption parallelOption, ActionWithState stateOption, ActionWithLocal localOption) { var parameters = new TestParameters(api, startIndexBase) { Count = count, ParallelOption = parallelOption, StateOption = stateOption, LocalOption = localOption }; var test = new ParallelForTest(parameters); test.RealRun(); }