Skip to content

Commit

Permalink
Merge pull request #2 from pveber/core_kernel
Browse files Browse the repository at this point in the history
Reduced dep to Core_kernel
  • Loading branch information
agarwal committed Jun 16, 2014
2 parents 79fb7f5 + dd49ccb commit 00432e0
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
4 changes: 4 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
CFStream Release Notes

cfstream-1.1.2 2014-06-16
-------------------------
* Reduced deps to core_kernel instead of core.

cfstream-1.1.1 2014-03-02
-------------------------
* Fix doc build bug.
Expand Down
2 changes: 1 addition & 1 deletion OMakeroot
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ LIB_MODULES[] =
CFStream_streamable
CFStream_stream
CFStream
LIB_PACKAGES = core
LIB_PACKAGES = core_kernel

TEST_NAME = $(PROJECT)-test
TEST_MODULES[] = $(removesuffix $(basename $(ls src/test/test_*.ml)))
Expand Down
2 changes: 1 addition & 1 deletion bin/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ opam --git-version
# install OCaml packages
opam init
eval `opam config env`
opam install ocamlfind omake core
opam install ocamlfind omake core_kernel

# test this package
omake
Expand Down
2 changes: 1 addition & 1 deletion etc/opam/packages/cfstream.master/opam
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ build-doc: [
depends: [
"ocamlfind"
"omake"
"core"
"core_kernel"
]

ocaml-version: [>="4.00.1"]
2 changes: 1 addition & 1 deletion src/lib/CFStream_stream.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
open Core.Std
open Core_kernel.Std

include Stream
let next_exn = next
Expand Down
4 changes: 2 additions & 2 deletions src/lib/CFStream_stream.mli
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
In general, functions that return a stream return a "fresh"
stream, meaning that their count is set to 0.
*)
open Core.Std
open Core_kernel.Std

(** Type of streams holding values of type ['a]. *)
type 'a t = 'a Stream.t
Expand Down Expand Up @@ -362,7 +362,7 @@ val of_string : string -> char t
(** Convert exception-less stream to exception-ful stream. Resulting
stream raises exception at first error seen. *)
val result_to_exn :
('output, 'error) Core.Std.Result.t t ->
('output, 'error) Result.t t ->
error_to_exn:('error -> exn) ->
'output t

Expand Down
22 changes: 11 additions & 11 deletions src/test/test_stream.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
open Core.Std
open Core_kernel.Std
open OUnit
open CFStream_stream
open CFStream_stream.Infix
Expand All @@ -18,7 +18,7 @@ let test_exists () =

let test_group () =
let f x = x mod 2 in
let groups =
let groups =
[ 1 ; 3 ; 4 ; 5 ; 4 ; 2 ; 9]
|! of_list
|! group ~f
Expand All @@ -29,15 +29,15 @@ let test_group () =

(* now the same test but visiting the groups in the reverse order
(triggers forcing of previous streams) *)
let groups =
let groups =
[ 1 ; 3 ; 4 ; 5 ; 4 ; 2 ; 9]
|! of_list
|! group ~f
|! to_list
|! List.rev_map ~f:to_list
|! List.rev
in
assert_equal
assert_equal
~msg:"Find groups with same parity (reverse order)"
groups [ [ 1 ; 3 ] ; [ 4 ] ; [ 5 ] ; [ 4 ; 2 ] ; [ 9 ] ]

Expand All @@ -49,7 +49,7 @@ let test_concat () =
|! group ~f
|! concat
|! to_list
in
in
assert_equal
~msg:"Concat grouped enum is idempotent"
l m
Expand All @@ -68,15 +68,15 @@ let test_uncombine () =
assert_equal ~printer:int_list_printer ~msg:"Check first list" (List.rev l1) [ 1 ; 3 ; 5 ; 7 ] ;
assert_equal ~printer:int_list_printer ~msg:"Check second list" (List.rev l2) [ 2 ; 4 ; 6 ; 8 ]

let test_partition () =
let test_partition () =
let f x = x mod 2 = 0 in
let l = List.init 100 ~f:(fun _ -> Random.int 10) in
let r1 = Caml.List.partition f l in
let r2 =
of_list l
|! partition ~f
|! (fun (a, b) -> (to_list a, to_list b))
in
in
assert_equal
~printer:int_list_tuple_printer
~msg:"Check stream partition against list partition"
Expand All @@ -87,19 +87,19 @@ let test_iter () =
let c = ref [] in
let f x = c := x :: !c in
iter (Stream.of_list l) ~f ;
assert_equal
assert_equal
~printer:int_list_printer
~msg:"Check list built with iter"
l (List.rev !c)

let test_take () =
assert_equal
assert_equal
~printer:int_list_printer
~msg:"Check take"
[1;2;3] (to_list (take (of_list [1;2;3;4;5]) 3)) ;
let s = of_list [1;2;3;4;5] in
ignore (next s) ;
assert_equal
assert_equal
~printer:int_list_printer
~msg:"Check take after changing the stream count"
[2;3;4] (to_list (take s 3))
Expand Down Expand Up @@ -170,7 +170,7 @@ let test_skip () =
~msg:"Check [skip]'ed lists (by hand and by [uniq]"
[ 6;-1;-2;7;8 ]
([ -5 ; -5 ; -6 ;6;-1;-2;7;8 ] |! of_list |! skip_while ~f:(( > ) 0) |! to_list)


let tests = "Stream" >::: [
"Exists" >:: test_exists;
Expand Down

0 comments on commit 00432e0

Please sign in to comment.