diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2018-09-16 17:09:50 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2018-09-16 17:09:50 +0700 |
commit | af7355a81832318dd9b3125be82c12389ec0cb90 (patch) | |
tree | f74d46d08aae3daf979437d035c72f4c9ea659f0 /crypto/test/src/util | |
parent | Fixed Rfc3211WrapEngine processing of messages over 127 bytes. (diff) | |
download | BouncyCastle.NET-ed25519-af7355a81832318dd9b3125be82c12389ec0cb90.tar.xz |
Blake2b/s: relax length-only constructor constraints
- addresses https://github.com/bcgit/bc-csharp/issues/142
Diffstat (limited to 'crypto/test/src/util')
-rw-r--r-- | crypto/test/src/util/test/SimpleTest.cs | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/crypto/test/src/util/test/SimpleTest.cs b/crypto/test/src/util/test/SimpleTest.cs index 154da27f4..dd27205c8 100644 --- a/crypto/test/src/util/test/SimpleTest.cs +++ b/crypto/test/src/util/test/SimpleTest.cs @@ -27,6 +27,21 @@ namespace Org.BouncyCastle.Utilities.Test throw new TestFailedException(SimpleTestResult.Failed(this, message)); } + internal void Fail( + string message, + Exception throwable) + { + throw new TestFailedException(SimpleTestResult.Failed(this, message, throwable)); + } + + internal void Fail( + string message, + object expected, + object found) + { + throw new TestFailedException(SimpleTestResult.Failed(this, message, expected, found)); + } + internal void IsTrue(bool value) { if (!value) @@ -39,22 +54,44 @@ namespace Org.BouncyCastle.Utilities.Test throw new TestFailedException(SimpleTestResult.Failed(this, message)); } - internal void Fail( - string message, - Exception throwable) + internal void IsEquals(object a, object b) { - throw new TestFailedException(SimpleTestResult.Failed(this, message, throwable)); + if (!a.Equals(b)) + throw new TestFailedException(SimpleTestResult.Failed(this, "no message")); } - internal void Fail( - string message, - object expected, - object found) + internal void IsEquals(int a, int b) { - throw new TestFailedException(SimpleTestResult.Failed(this, message, expected, found)); + if (a != b) + throw new TestFailedException(SimpleTestResult.Failed(this, "no message")); + } + + internal void IsEquals(string message, bool a, bool b) + { + if (a != b) + throw new TestFailedException(SimpleTestResult.Failed(this, message)); + } + + internal void IsEquals(string message, long a, long b) + { + if (a != b) + throw new TestFailedException(SimpleTestResult.Failed(this, message)); + } + + internal void IsEquals(string message, object a, object b) + { + if (a == null && b == null) + return; + + if (a == null) + throw new TestFailedException(SimpleTestResult.Failed(this, message)); + if (b == null) + throw new TestFailedException(SimpleTestResult.Failed(this, message)); + if (!a.Equals(b)) + throw new TestFailedException(SimpleTestResult.Failed(this, message)); } - internal bool AreEqual( + internal bool AreEqual( byte[] a, byte[] b) { |