File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 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) {
68876887 CHECK (secp256k1_memcmp_var (buf1 , buf2 , sizeof (buf1 )) == 0 );
68886888}
68896889
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+
68906903void int_cmov_test (void ) {
68916904 int r = INT_MAX ;
68926905 int a = 0 ;
@@ -7161,6 +7174,7 @@ int main(int argc, char **argv) {
71617174
71627175 /* util tests */
71637176 run_secp256k1_memczero_test ();
7177+ run_secp256k1_byteorder_tests ();
71647178
71657179 run_cmov_tests ();
71667180
You can’t perform that action at this time.
0 commit comments