Sha256: 76178bbe26fc687a319e8be3c963b4a3f6954284b5f14f96897df010232751e4
Contents?: true
Size: 859 Bytes
Versions: 7
Compression:
Stored size: 859 Bytes
Contents
using System; using Generators.Input; namespace Generators.Exercises { public class Grains : Exercise { protected override void UpdateCanonicalData(CanonicalData canonicalData) { foreach (var canonicalDataCase in canonicalData.Cases) { if (ShouldThrowException(canonicalDataCase.Expected)) { canonicalDataCase.ExceptionThrown = typeof(ArgumentOutOfRangeException); } else { canonicalDataCase.Expected = ulong.Parse(canonicalDataCase.Expected.ToString()); } } } private static bool ShouldThrowException(object value) { return int.TryParse(value.ToString(), out int result) && result == -1; } } }
Version data entries
7 entries across 7 versions & 1 rubygems