search for: assert_equal_int

Displaying 20 results from an estimated 37 matches for "assert_equal_int".

2019 Jan 16
1
Re: [PATCH 3/5] mltools: add simple tests for external_command
...on/mltools/tools_utils_tests.ml b/common/mltools/tools_utils_tests.ml > index 1489fe699..f3c39514d 100644 > --- a/common/mltools/tools_utils_tests.ml > +++ b/common/mltools/tools_utils_tests.ml > @@ -28,6 +28,7 @@ let assert_equal_string = assert_equal ~printer:(fun x -> x) > let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x) > let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x) > let assert_equal_intlist = assert_equal ~printer:(fun x -> "(" ^ (String.concat ";" (List.map string_of_int x)) ^ ")") &g...
2015 Jan 22
3
[PATCH 1/2] configure: look for the oUnit OCaml module
It will be used for the OCaml unit tests. --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index e0fb481..e360bbb 100644 --- a/configure.ac +++ b/configure.ac @@ -1120,6 +1120,7 @@ AS_IF([test "x$OCAMLC" != "xno"],[ ]) OCAML_PKG_gettext=no +OCAML_PKG_oUnit=no AS_IF([test "x$OCAMLC" != "xno"],[ #
2015 Jan 22
0
[PATCH 2/2] mllib: convert common_utils_tests to oUnit
...a/mllib/common_utils_tests.ml +++ b/mllib/common_utils_tests.ml @@ -18,84 +18,117 @@ (* This file tests the Common_utils module. *) +open OUnit open Common_utils let prog = "common_utils_tests" +(* Utils. *) +let assert_equal_string = assert_equal ~printer:(fun x -> x) +let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x) +let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x) + (* Test Common_utils.int_of_le32 and Common_utils.le32_of_int. *) -let () = - assert (int_of_le32 "\x80\x60\x40\x20" = 0x20406080L); - assert (le32_of...
2019 Jan 16
0
[PATCH 3/5] mltools: add simple tests for external_command
...ons(+) diff --git a/common/mltools/tools_utils_tests.ml b/common/mltools/tools_utils_tests.ml index 1489fe699..f3c39514d 100644 --- a/common/mltools/tools_utils_tests.ml +++ b/common/mltools/tools_utils_tests.ml @@ -28,6 +28,7 @@ let assert_equal_string = assert_equal ~printer:(fun x -> x) let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x) let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x) let assert_equal_intlist = assert_equal ~printer:(fun x -> "(" ^ (String.concat ";" (List.map string_of_int x)) ^ ")") +let assert_...
2018 Aug 20
0
[PATCH 4/4] mltools: JSON: unify JSON_parser type with JSON.json_t.
...all the JSON objects matching the [fn] function in [obj] list. *) diff --git a/common/mltools/JSON_parser_tests.ml b/common/mltools/JSON_parser_tests.ml index 42045122d..e7e3112b5 100644 --- a/common/mltools/JSON_parser_tests.ml +++ b/common/mltools/JSON_parser_tests.ml @@ -27,16 +27,15 @@ let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x) let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x) let assert_equal_bool = assert_equal ~printer:(fun x -> string_of_bool x) -let string_of_json_parser_val_type = function - | JSON_parser_null -> "null...
2018 Aug 22
3
[PATCH v2 0/2] mltools: JSON: unify JSON & JSON parser.
v2: - Added back the null value. - Reran the tests. Rich.
2019 Jan 16
10
[PATCH 0/5] [RFC] builder: handle unavailable repos
In case a repository of virt-builder references files (e.g. the index) that cannot be downloaded (network issues, 404, etc) then virt-builder errors out on this situation. This is not a nice situation, from an user POV. This series does some refactoring to allow to better handle downloading failures, and handle the failures gracefully in virt-builder. RFC because I'm not yet too convinced
2017 Jun 20
2
[PATCH v2 1/2] mllib: add new Common_utils.run_commands
...whether output the full command on verbose diff --git a/mllib/common_utils_tests.ml b/mllib/common_utils_tests.ml index aacc01e..4c9f53f 100644 --- a/mllib/common_utils_tests.ml +++ b/mllib/common_utils_tests.ml @@ -26,6 +26,7 @@ let assert_equal_string = assert_equal ~printer:(fun x -> x) let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x) let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x) let assert_equal_stringlist = assert_equal ~printer:(fun x -> "(" ^ (String.escaped (String.concat "," x)) ^ ")") +let assert_equal...
2018 Aug 20
6
[PATCH 0/4] mltools: JSON unification
An evolution of: https://www.redhat.com/archives/libguestfs/2018-August/msg00155.html
2016 Dec 18
0
[PATCH v4 4/6] mllib: modify nsplit to take optional noempty and count arguments
...of the separator [sep], returning the part before and the part after. diff --git a/mllib/common_utils_tests.ml b/mllib/common_utils_tests.ml index ee27b93..ef5665f 100644 --- a/mllib/common_utils_tests.ml +++ b/mllib/common_utils_tests.ml @@ -109,6 +109,32 @@ let test_string_find ctx = assert_equal_int (-1) (String.find "" "baz"); assert_equal_int (-1) (String.find "foobar" "baz") +(* Test Common_utils.String.nsplit *) +let test_string_nsplit ctx = + (* Basic functionality *) + assert_equal_stringlist [""] (String.nsplit "," &quot...
2015 Jan 23
2
[PATCH 1/2] mllib: tests: add tests for string_lines_split
...diff --git a/mllib/common_utils_tests.ml b/mllib/common_utils_tests.ml index 09d5c51..283e9a1 100644 --- a/mllib/common_utils_tests.ml +++ b/mllib/common_utils_tests.ml @@ -27,6 +27,7 @@ let prog = "common_utils_tests" let assert_equal_string = assert_equal ~printer:(fun x -> x) let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x) let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x) +let assert_equal_stringlist = assert_equal ~printer:(fun x -> "(" ^ (String.escaped (String.concat "," x)) ^ ")") (* Test Common...
2015 May 11
3
[PATCH 1/2] mllib: Require OUnit2 for tests.
...ware; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ (* This file tests the Common_utils module. *) -open OUnit +open OUnit2 open Common_utils let prog = "common_utils_tests" @@ -30,12 +30,12 @@ let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x) let assert_equal_stringlist = assert_equal ~printer:(fun x -> "(" ^ (String.escaped (String.concat "," x)) ^ ")") (* Test Common_utils.int_of_le32 and Common_utils.le32_of_int. *) -let test_le32 () = +let...
2017 Jan 30
0
[PATCH v6 2/3] mllib: modify nsplit to take optional noempty and count arguments
...the separator [sep], returning the part before and the part after. diff --git a/mllib/common_utils_tests.ml b/mllib/common_utils_tests.ml index 77b0524c1..e30179323 100644 --- a/mllib/common_utils_tests.ml +++ b/mllib/common_utils_tests.ml @@ -109,6 +109,35 @@ let test_string_find ctx = assert_equal_int (-1) (String.find "" "baz"); assert_equal_int (-1) (String.find "foobar" "baz") +(* Test Common_utils.String.nsplit *) +let test_string_nsplit ctx = + (* Basic functionality *) + assert_equal_stringlist [""] (String.nsplit "|" &quot...
2017 Jul 21
3
[PATCH] common/mlstdutils: Add chomp function to remove \n from end of strings.
...val explode : string -> char list diff --git a/common/mlstdutils/std_utils_tests.ml b/common/mlstdutils/std_utils_tests.ml index 2789766c6..ce49c7606 100644 --- a/common/mlstdutils/std_utils_tests.ml +++ b/common/mlstdutils/std_utils_tests.ml @@ -110,6 +110,15 @@ let test_string_span ctx = assert_equal_int 3 (String.cspan "def" "ab"); assert_equal_int 0 (String.cspan "" "ab") +(* Test Std_utils.String.chomp. *) +let test_string_chomp ctx = + assert_equal_string "a" (String.chomp "a"); + assert_equal_string "a" (String.chomp...
2018 Aug 17
0
[PATCH v3 1/4] mltools: Rename Yajl module as JSON_parser and move to common/mltools.
...Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) -(* This file tests the Yajl module. *) +(* This file tests the JSON_parser module. *) open OUnit2 -open Yajl +open JSON_parser (* Utils. *) let assert_equal_string = assert_equal ~printer:(fun x -> x) @@ -27,16 +27,16 @@ let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x) let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x) let assert_equal_bool = assert_equal ~printer:(fun x -> string_of_bool x) -let string_of_yajl_val_type = function - | Yajl_null -> "null" - | Ya...
2018 Aug 17
8
[PATCH v3 4/4] v2v: Add --print-estimate option to print copy size
I rethought this again, as I think that it's a dangerous assumption to bake qemu-img measure output into our API. This patch series runs qemu-img measure behind the scenes, but then parses the output and sums it to a single number which we print. Doing that required a bit of reworking, moving the Jansson [JSON parser] bindings from virt-builder into the common directory and a couple of other
2017 Jun 15
0
[PATCH v6 04/41] mllib: Split ‘Common_utils’ into ‘Std_utils’ + ‘Common_utils’.
...this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + *) + +(* This file tests the Std_utils module. *) + +open OUnit2 +open Std_utils + +(* Utils. *) +let assert_equal_string = assert_equal ~printer:(fun x -> x) +let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x) +let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x) +let assert_equal_stringlist = assert_equal ~printer:(fun x -> "(" ^ (String.escaped (String.concat "," x)) ^ ")") + +let test_subdi...
2018 Aug 23
2
[PATCH 1/2] mltools: JSON: add json_parser_tree_parse_file
...file tmpfile in + assert_is_object value + end; + begin + let tmpfile, chan = bracket_tmpfile ctx in + output_string chan "{\"foo\":5}\n"; + flush chan; + close_out chan; + let value = json_parser_tree_parse_file tmpfile in + let l = get_dict value in + assert_equal_int 1 (List.length l); + assert_equal_string "foo" (fst (List.hd l)); + assert_is_number 5_L (snd (List.hd l)); + end; + () + (* Suites declaration. *) let suite = "mltools JSON_parser" >::: @@ -129,6 +151,7 @@ let suite = "tree_parse.invalid" >::...
2015 Sep 07
5
[PATCH 0/4 v3] builder: support for Simple Streams metadata
Hi, this series adds a basic support for Simple Streams v1.0 metadata files. This makes it possible to create a repository .conf files with [cirros] uri=http://download.cirros-cloud.net format=simplestreams to read the latest version of each CirrOS image. Thanks, Pino Toscano (4): builder: add non-int revisions builder: add simple libyajl binding build: expose HAVE_YAJL to automake
2019 Jan 11
3
[PATCH 1/3] mlstdutils: add a very simple test for Std_utils.which
...utils_tests.ml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/mlstdutils/std_utils_tests.ml b/common/mlstdutils/std_utils_tests.ml index 81f512cbf..f7b0247a4 100644 --- a/common/mlstdutils/std_utils_tests.ml +++ b/common/mlstdutils/std_utils_tests.ml @@ -29,6 +29,11 @@ let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x) let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x) let assert_equal_stringlist = assert_equal ~printer:(fun x -> "(" ^ (String.escaped (String.concat "," x)) ^ ")") let assert_equal...