Beispiel #1
0
        private static IGen <char> CreateGen(Gen.CharType charType)
        {
            if (charType <= 0 || charType > Gen.CharType.All)
            {
                return(Gen.Advanced.Error <char>(nameof(CharGen), "'charType' was not a valid flag value"));
            }

            var chars = CharacterSetsByFlag
                        .Aggregate(
                Enumerable.Empty <char>(),
                (acc, curr) => charType.HasFlag(curr.Key) ? acc.Concat(curr.Value) : acc)
                        .ToList();

            return(Gen.Int32().Between(0, chars.Count - 1).Select(i => chars[i]));
        }
Beispiel #2
0
 public record FromCharType(Gen.CharType CharType) : StringGenCharConfig;
Beispiel #3
0
 public CharGen(Gen.CharType charType)
 {
     _charType = charType;
 }