aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmain.ml5
-rwxr-xr-xsheet.ml2
-rwxr-xr-xsheet.mli4
-rwxr-xr-xtests/sheet_test.ml16
4 files changed, 13 insertions, 14 deletions
diff --git a/main.ml b/main.ml
index e91a9f5..9ecdf84 100755
--- a/main.ml
+++ b/main.ml
@@ -216,8 +216,7 @@ and command (t, screen) action = begin
Odf.save t.Sheet.data file;
normal_mode @@ redraw t screen
| ("enew", _) -> (* Start a new spreadsheet *)
- let sheet = Sheet.Raw.create in
- normal_mode @@ redraw (Sheet.create sheet) screen
+ normal_mode @@ redraw (Sheet.create Sheet.Raw.empty) screen
| ("q", _) -> (* Quit *)
t
| _ -> normal_mode @@ redraw t screen
@@ -227,7 +226,7 @@ let () = begin
let sheet =
if Array.length Sys.argv = 1 then
- Sheet.Raw.create
+ Sheet.Raw.empty
else
Odf.load Sys.argv.(1) in
diff --git a/sheet.ml b/sheet.ml
index a31c9ef..24326e8 100755
--- a/sheet.ml
+++ b/sheet.ml
@@ -33,7 +33,7 @@ module Raw = struct
sink = Cell.Set.empty;
}
- let create = Map.empty
+ let empty = Map.empty
let get_value id t = begin
try (Map.find id t).value
diff --git a/sheet.mli b/sheet.mli
index 0762419..11881cc 100755
--- a/sheet.mli
+++ b/sheet.mli
@@ -6,8 +6,8 @@ module Raw: sig
type t
- (** Create a new sheet *)
- val create: t
+ (** An empty sheet *)
+ val empty: t
(** Add a new value in the sheet. The previous value is replaced
@return All the successors to update and the new sheet.
diff --git a/tests/sheet_test.ml b/tests/sheet_test.ml
index c1af5d5..71f5749 100755
--- a/tests/sheet_test.ml
+++ b/tests/sheet_test.ml
@@ -19,7 +19,7 @@ end
(** Test a simple references between two cells *)
let test_create_ref_1 ctx = begin
- let s = Sheet.Raw.create
+ let s = Sheet.Raw.empty
|> Sheet.Raw.add (3,3) @@ Expression.load @@ u"=-1"
|> snd |> Sheet.Raw.add (0,0) @@ Expression.load @@ u"=C3"
|> snd in
@@ -34,7 +34,7 @@ end
let test_create_ref_2 ctx = begin
- let s = Sheet.Raw.create
+ let s = Sheet.Raw.empty
|> Sheet.Raw.add (2,2) @@ Expression.load @@ u"=C3"
|> snd |> Sheet.Raw.add (3,3) @@ Expression.load @@ u"=A1"
|> snd |> Sheet.Raw.add (1,1) @@ Expression.load @@ u"123"
@@ -52,7 +52,7 @@ end
let test_create_direct_cycle ctx = begin
- let s = Sheet.Raw.create
+ let s = Sheet.Raw.empty
|> Sheet.Raw.add (2,2) @@ Expression.load @@ u"=B2 + 1"
|> snd in
let result = (Sheet.Raw.get_value (2, 2) s) in
@@ -66,7 +66,7 @@ end
let test_create_indirect_cycle ctx = begin
- let s = Sheet.Raw.create
+ let s = Sheet.Raw.empty
|> Sheet.Raw.add (2,2) @@ Expression.load @@ u"=A1"
|> snd |> Sheet.Raw.add (1,1) @@ Expression.load @@ u"=2"
|> snd |> Sheet.Raw.add (1,1) @@ Expression.load @@ u"=B2+1"
@@ -83,7 +83,7 @@ end
let test_check_cycle3 ctx = begin
- let s = Sheet.Raw.create
+ let s = Sheet.Raw.empty
(* First set A1 to 3 *)
|> Sheet.Raw.add (1,1) @@ Expression.load @@ u"=3"
|> snd |> Sheet.Raw.add (1,2) @@ Expression.load @@ u"=A1"
@@ -106,7 +106,7 @@ end
let test_delete ctx = begin
- let s = Sheet.Raw.create
+ let s = Sheet.Raw.empty
|> Sheet.Raw.add (2,2) @@ Expression.load @@ u"=C3"
|> snd |> Sheet.Raw.add (3,3) @@ Expression.load @@ u"=A1"
|> snd |> Sheet.Raw.remove (2,2)
@@ -123,7 +123,7 @@ end
let test_update_succs1 ctx = begin
- let result = Sheet.Raw.create
+ let result = Sheet.Raw.empty
|> Sheet.Raw.add (1,1) @@ Expression.load @@ u" =1"
|> snd |> Sheet.Raw.add (2,2) @@ Expression.load @@ u"=A2"
|> snd |> Sheet.Raw.add (1,2) @@ Expression.load @@ u"=A1/1"
@@ -144,7 +144,7 @@ end
let test_update_succs2 ctx = begin
- let result = Sheet.Raw.create
+ let result = Sheet.Raw.empty
|> Sheet.Raw.add (1,1) @@ Expression.load @@ u"=1"
|> snd |> Sheet.Raw.add (2,2) @@ Expression.load @@ u"=A2"
|> snd |> Sheet.Raw.add (1,2) @@ Expression.load @@ u"=A1/0"