public PairwiseObjectArrayEnumerator(PairwiseSettings settings, PairwiseModel model, IList[] lists) { this.settings = settings; this.model = model; this.tupleLen = model.Parameters.Count; this.lists = (IList[])lists.Clone(); current = -1; rebuildRequired = true; allTuples = null; // readonly cur this.cur = null; this.Reset(); }
public PairwiseObjectArrayCollection(int order, params IEnumerable[] enumerables) { this.settings = new PairwiseSettings(order, true); this.lists = new IList[enumerables.Length]; // build the big lookup table this.model = new PairwiseModel(); for (int i = 0; i < enumerables.Length; ++i) { // the enumerator from here is disposed (if necessary) in the below foreach loop IEnumerable origList = enumerables[i]; bool copy; IList temp = origList as IList; if (temp != null) { copy = false; } else { temp = new ArrayList(); copy = true; } int index = 0; PairwiseParameter param = new PairwiseParameter("P" + i.ToString(PictConstants.Culture)); foreach (object item in origList) { if (copy) { temp.Add(item); } param.AddValue(index); ++index; } this.lists[i] = temp; model.Parameters.Add(param); } }
public static PairwiseTestMatrix GenerateMatrixFromPictFile(string modelFile, PairwiseSettings settings) { if (modelFile == null) { throw new ArgumentNullException("modelFile"); } if (settings == null) { throw new ArgumentNullException("settings"); } string[][] results = null; PairwiseTestMatrix matrix = new PairwiseTestMatrix(); using (PictRunner pr = new PictRunner()) { results = pr.AlwaysExecutePictOnFileName(modelFile, settings); matrix.PictExecutionInformation = pr.LastExecutionInformation; } string[] headerFields = results[0]; PairwiseTestCase[] cases = new PairwiseTestCase[results.Length - 1]; for (int tupleNo = 0; tupleNo < cases.Length; ++tupleNo) { string[] fields = results[tupleNo + 1]; PairwiseTestParameter[] values = new PairwiseTestParameter[fields.Length]; for (int field = 0; field < fields.Length; ++field) { values[field] = new PairwiseTestParameter(headerFields[field], fields[field]); } cases[tupleNo] = new PairwiseTestCase(values); } // NOTE: sorting makes things easier to diff, kinda Array.Sort(cases, PairwiseTestCase.Comparer); matrix.PairwiseTestCases = cases; return(matrix); }
public static PairwiseTestMatrix GenerateMatrixFromPictFile(string modelFile, string pictArgs) { PairwiseSettings settings = PairwiseSettings.Parse(pictArgs); return(GenerateMatrixFromPictFile(modelFile, settings)); }