-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #480 from yallop/register-unsigned-custom-ops
Register custom operations for unsigned integers
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(* | ||
* Copyright (c) 2016 Jeremy Yallop. | ||
* | ||
* This file is distributed under the terms of the MIT License. | ||
* See the file LICENSE for details. | ||
*) | ||
|
||
open OUnit2 | ||
open Ctypes | ||
open Unsigned | ||
|
||
|
||
(* | ||
Test marshalling and unmarshalling custom integers | ||
*) | ||
let test_integer_marshalling _ = | ||
let v = ( | ||
UInt8.zero, UInt16.zero, UInt32.zero, UInt64.zero, | ||
UInt8.one, UInt16.one, UInt32.one, UInt64.one, | ||
UInt8.of_string "100", UInt16.of_string "1000", | ||
UInt32.of_string "10000", UInt64.of_string "100000", | ||
UInt8.max_int, UInt16.max_int, UInt32.max_int, UInt64.max_int | ||
) in | ||
assert_equal v Marshal.(from_string (to_string v []) 0) | ||
|
||
|
||
let suite = "Marshal tests" >::: | ||
["integer marshalling" | ||
>:: test_integer_marshalling; | ||
] | ||
|
||
|
||
let _ = | ||
run_test_tt_main suite |