File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -6887,6 +6887,19 @@ void run_secp256k1_memczero_test(void) {
6887
6887
CHECK (secp256k1_memcmp_var (buf1 , buf2 , sizeof (buf1 )) == 0 );
6888
6888
}
6889
6889
6890
+ void run_secp256k1_byteorder_tests (void ) {
6891
+ const uint32_t x = 0xFF03AB45 ;
6892
+ const unsigned char x_be [4 ] = {0xFF , 0x03 , 0xAB , 0x45 };
6893
+ unsigned char buf [4 ];
6894
+ uint32_t x_ ;
6895
+
6896
+ secp256k1_write_be32 (buf , x );
6897
+ CHECK (secp256k1_memcmp_var (buf , x_be , sizeof (buf )) == 0 );
6898
+
6899
+ x_ = secp256k1_read_be32 (buf );
6900
+ CHECK (x == x_ );
6901
+ }
6902
+
6890
6903
void int_cmov_test (void ) {
6891
6904
int r = INT_MAX ;
6892
6905
int a = 0 ;
@@ -7161,6 +7174,7 @@ int main(int argc, char **argv) {
7161
7174
7162
7175
/* util tests */
7163
7176
run_secp256k1_memczero_test ();
7177
+ run_secp256k1_byteorder_tests ();
7164
7178
7165
7179
run_cmov_tests ();
7166
7180
You can’t perform that action at this time.
0 commit comments