コード例 #1
0
        public static void AssertNotStructurallyEqual([CanBeNull] ZilObject notExpected, [CanBeNull] ZilObject actual)
        {
            bool ok;

            if (notExpected == null || actual == null)
            {
                ok = !ReferenceEquals(notExpected, actual);
            }
            else
            {
                ok = !notExpected.StructurallyEquals(actual);
            }

            if (!ok)
            {
                throw new AssertFailedException(
                          $"{nameof(TestHelpers)}.{nameof(AssertNotStructurallyEqual)} failed. Not expected:<{notExpected}>. Actual:<{actual}>.");
            }
        }
コード例 #2
0
        internal static void AssertStructurallyEqual([CanBeNull] ZilObject expected, [CanBeNull] ZilObject actual, [CanBeNull] string message = null)
        {
            bool ok;

            if (expected == null || actual == null)
            {
                ok = ReferenceEquals(expected, actual);
            }
            else
            {
                ok = expected.StructurallyEquals(actual);
            }

            if (!ok)
            {
                message = message ?? $"{nameof(TestHelpers)}.{nameof(AssertStructurallyEqual)} failed";
                throw new AssertFailedException($"{message}. Expected:<{expected}>. Actual:<{actual}>.");
            }
        }
コード例 #3
0
        internal static void AssertStructurallyEqual([CanBeNull] ZilObject expected, [CanBeNull] ZilObject actual, [NotNull] string format, [NotNull] params object[] args)
        {
            bool ok;

            if (expected == null || actual == null)
            {
                ok = ReferenceEquals(expected, actual);
            }
            else
            {
                ok = expected.StructurallyEquals(actual);
            }

            if (!ok)
            {
                var message = string.Format(format, args);
                throw new AssertFailedException($"{message}. Expected:<{expected}>. Actual:<{actual}>.");
            }
        }
コード例 #4
0
 public static ZilObject NEq_P([NotNull] Context ctx, [NotNull] ZilObject a, [NotNull] ZilObject b)
 {
     return(a.StructurallyEquals(b) ? ctx.FALSE : ctx.TRUE);
 }