Sha256: 9bcb176b5e58d6c9a1843da8bda612e80cce44b2328ff62e539f43e8ab1072b5
Contents?: true
Size: 1.82 KB
Versions: 28
Compression:
Stored size: 1.82 KB
Contents
using Generators.Input; using Generators.Output; namespace Generators.Exercises { public class CustomSet : GeneratorExercise { protected override void UpdateCanonicalData(CanonicalData canonicalData) { foreach (var canonicalDataCase in canonicalData.Cases) { canonicalDataCase.UseVariablesForInput = true; if (canonicalDataCase.Input.ContainsKey("set")) { if (!(canonicalDataCase.Input["set"] is int[])) { canonicalDataCase.Input["set"] = new UnescapedValue(""); } canonicalDataCase.SetConstructorInputParameters("set"); } else { if (!(canonicalDataCase.Input["set1"] is int[])) { canonicalDataCase.Input["set1"] = new UnescapedValue(""); } canonicalDataCase.SetConstructorInputParameters("set1"); canonicalDataCase.Input["set2"] = ConvertCustomSet(canonicalDataCase.Input["set2"]); if (canonicalDataCase.Property == "equal") { canonicalDataCase.Property = "Equals"; } } canonicalDataCase.Expected = ConvertCustomSet(canonicalDataCase.Expected); } } private static dynamic ConvertCustomSet(dynamic value) { if (value is bool) return value; if (value is int[] values && values.Length > 0) { return new UnescapedValue($"new CustomSet({ValueFormatter.Format(values)})"); } return new UnescapedValue($"new CustomSet()"); } } }
Version data entries
28 entries across 28 versions & 1 rubygems