Exemple #1
0
 /// <summary>
 /// Imports the dimension exploration strategies for the given innner matrix found with the given source combinatorial strategy.
 /// </summary>
 /// <param name="innerMatrix">The inner matrix.</param>
 /// <param name="sourceStrategy">The source strategy.</param>
 /// <remarks>
 /// This is useful for exploring dimensions from a sub-matrix in the same strategy, which is useful e.g. for doing pairwise coverage
 /// across sub-matrix boundaries.
 /// </remarks>
 /// <returns>The number of strategies imported.</returns>
 /// <exception cref="ArgumentNullException">Any of the parameters is null.</exception>
 public int ImportSubMatrixStrategies(Matrix innerMatrix, CombinatorialStrategy sourceStrategy)
 {
     if (innerMatrix == null)
     {
         throw new ArgumentNullException("innerMatrix");
     }
     return(ImportSubMatrixStrategies(new Matrix[] { innerMatrix }, sourceStrategy));
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CombinatorialStrategy"/> class as a copy of the given strategy.
 /// </summary>
 /// <param name="sourceStrategy">The source strategy.</param>
 /// <exception cref="ArgumentNullException"><paramref name="sourceStrategy"/> is null.</exception>
 protected CombinatorialStrategy(CombinatorialStrategy sourceStrategy)
 {
     if (sourceStrategy == null)
     {
         throw new ArgumentNullException("sourceStrategy");
     }
     _targetMatrix = sourceStrategy._targetMatrix;
     _constraints  = new List <IConstraint>(sourceStrategy._constraints);
     ImportDimensionStrategies(sourceStrategy);
 }
Exemple #3
0
        /// <summary>
        /// Imports the dimension exploration strategies for the given innner matrix found with the given source combinatorial strategy.
        /// </summary>
        /// <param name="innerMatrixPath">The inner matrix path.</param>
        /// <param name="sourceStrategy">The source strategy.</param>
        /// <remarks>
        /// This is useful for exploring dimensions from a sub-matrix in the same strategy, which is useful e.g. for doing pairwise coverage
        /// across sub-matrix boundaries.
        /// </remarks>
        /// <returns>The number of strategies imported.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="sourceStrategy"/> is null.</exception>
        public int ImportSubMatrixStrategies(IEnumerable <Matrix> innerMatrixPath, CombinatorialStrategy sourceStrategy)
        {
            if (sourceStrategy == null)
            {
                throw new ArgumentNullException("sourceStrategy");
            }
            if (innerMatrixPath == null || innerMatrixPath.Any(m => m == null))
            {
                throw new ArgumentNullException("innerMatrixPath");
            }
            int ret = 0;

            foreach (KeyValuePair <QualifiedDimension, IExplorationStrategy> dimStrategy in sourceStrategy._explorationStrategies)
            {
                SetDimensionStrategyBase(QualifiedDimension.Create(dimStrategy.Key.BaseDimension,
                                                                   innerMatrixPath.Concat(dimStrategy.Key.Path)), dimStrategy.Value);
                ret++;
            }
            _constraints.AddRange(sourceStrategy._constraints.Select <IConstraint, IConstraint>(c => new InnerSubMatrixWrapperConstraint(c, innerMatrixPath)));
            return(ret);
        }
Exemple #4
0
        /// <summary>
        /// Imports the dimension exploration strategies from any common dimensions found with the given source combinatorial strategy.
        /// </summary>
        /// <remarks>
        /// If sourceStrategy has a test matrix with dimensions {A,B,C,D}, and it has known strategies for dimensions {A,B,C},
        /// and this strategy has dimensions {B,C,D,E}, then this method will import the strategies for dimensions {B,C}.
        /// </remarks>
        /// <param name="sourceStrategy"></param>
        /// <returns>The number of strategies imported.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="sourceStrategy"/> is null.</exception>
        public int ImportDimensionStrategies(CombinatorialStrategy sourceStrategy)
        {
            if (sourceStrategy == null)
            {
                throw new ArgumentNullException("sourceStrategy");
            }
            int ret = 0;

            foreach (KeyValuePair <QualifiedDimension, IExplorationStrategy> dimStrategy in sourceStrategy._explorationStrategies)
            {
                if (_explorationStrategies.ContainsKey(dimStrategy.Key))
                {
                    _explorationStrategies[dimStrategy.Key] = dimStrategy.Value;
                    ret++;
                }
                else if (_targetMatrix.Dimensions.Contains(dimStrategy.Key.FullPath.First()))
                {
                    _explorationStrategies.Add(dimStrategy.Key, dimStrategy.Value);
                    ret++;
                }
            }
            return(ret);
        }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PairwiseStrategy"/> class.
 /// </summary>
 /// <param name="sourceStrategy">The source strategy.</param>
 /// <exception cref="ArgumentNullException"><paramref name="sourceStrategy"/> is null.</exception>
 public PairwiseStrategy(CombinatorialStrategy sourceStrategy)
     : base(sourceStrategy)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ExhaustiveCombinatorialStrategy"/> class.
 /// </summary>
 /// <param name="sourceStrategy">The source strategy.</param>
 /// <exception cref="ArgumentNullException"><paramref name="sourceStrategy"/> is null.</exception>
 public ExhaustiveCombinatorialStrategy(CombinatorialStrategy sourceStrategy)
     : base(sourceStrategy)
 {
 }