Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
NativeSecp256k1Util.java
Go to the documentation of this file.
1/*
2 * Copyright 2014-2016 the libsecp256k1 contributors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.bitcoin;
18
20
21 public static void assertEquals( int val, int val2, String message ) throws AssertFailException{
22 if( val != val2 )
23 throw new AssertFailException("FAIL: " + message);
24 }
25
26 public static void assertEquals( boolean val, boolean val2, String message ) throws AssertFailException{
27 if( val != val2 )
28 throw new AssertFailException("FAIL: " + message);
29 else
30 System.out.println("PASS: " + message);
31 }
32
33 public static void assertEquals( String val, String val2, String message ) throws AssertFailException{
34 if( !val.equals(val2) )
35 throw new AssertFailException("FAIL: " + message);
36 else
37 System.out.println("PASS: " + message);
38 }
39
40 public static void checkArgument(boolean expression) {
41 if (!expression) {
42 throw new IllegalArgumentException();
43 }
44 }
45
46 public static class AssertFailException extends Exception {
47 public AssertFailException(String message) {
48 super( message );
49 }
50 }
51}
static void assertEquals(boolean val, boolean val2, String message)
static void assertEquals(String val, String val2, String message)
static void checkArgument(boolean expression)
static void assertEquals(int val, int val2, String message)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85