Commits

Peer Stritzinger committed b98a197

Rename new to new_packed to differentiated from other news.

Comments (0)

Files changed (1)

 
 -include_lib("eunit/include/eunit.hrl").
 
--export([new/3, new/4, to_list/1]). 
+-export([new_packed/3, new_packed/4, to_list/1]). 
 
 -record(ndarray, {dimensions, strides, type, elem_size, data}).
 
-new(Dims, Type, Elem_size) ->
-    new(Dims, Type, Elem_size, 0).
+new_packed(Dims, Type, Elem_size) ->
+    new_packed(Dims, Type, Elem_size, 0).
 
-new([_|_]=Dims, Type, Elem_size, Value) when is_integer(Elem_size),
+new_packed([_|_]=Dims, Type, Elem_size, Value) when is_integer(Elem_size),
 					     Elem_size > 0 ->
     case [ X || X <- Dims,  not(is_integer(X) and (X > 0))] of
 	[] -> ok;
 %% are those of the authors and should not be interpreted as representing
 %% official policies, either expressed or implied, of Peer Stritzinger GmbH.
 
-new_test_() ->
-    [?_assertEqual([[0,0],[0,0],[0,0]], to_list(new([3,2], integer, 32))),
-     ?_assertEqual([[1,1,1],[1,1,1]], to_list(new([2,3], integer, 8, 1))),
-     ?_assertEqual([[1,1,1],[1,1,1]], to_list(new([2,3], integer, 8, [1]))),
-     ?_assertEqual([[1,2,3],[1,2,3]], to_list(new([2,3], integer, 8, [1,2,3]))),
-     ?_assertEqual([[1,2,3],[4,5,6]], to_list(new([2,3], integer, 8, 
-						  [1,2,3,4,5,6]))),
-     ?_assertError(badarg, to_list(new([-1,3], integer, 8, 1))),
-     ?_assertError(badarg, to_list(new([2,0], integer, 8, 1))),
-     ?_assertError(function_clause, to_list(new([], integer, 8, 1))),
-     ?_assertError(function_clause, to_list(new([2,2], integer, 0, 1))),
+new_packed_test_() ->
+    [?_assertEqual([[0,0],[0,0],[0,0]], 
+		   to_list(new_packed([3,2], integer, 32))),
+     ?_assertEqual([[1,1,1],[1,1,1]], 
+		   to_list(new_packed([2,3], integer, 8, 1))),
+     ?_assertEqual([[1,1,1],[1,1,1]], 
+		   to_list(new_packed([2,3], integer, 8, [1]))),
+     ?_assertEqual([[1,2,3],[1,2,3]], 
+		   to_list(new_packed([2,3], integer, 8, [1,2,3]))),
+     ?_assertEqual([[1,2,3],[4,5,6]], 
+		   to_list(new_packed([2,3], integer, 8, [1,2,3,4,5,6]))),
+     ?_assertError(badarg, to_list(new_packed([-1,3], integer, 8, 1))),
+     ?_assertError(badarg, to_list(new_packed([2,0], integer, 8, 1))),
+     ?_assertError(function_clause, to_list(new_packed([], integer, 8, 1))),
+     ?_assertError(function_clause, to_list(new_packed([2,2], integer, 0, 1))),
      ?_assertEqual([[3.5,3.5],[3.5,3.5]], 
-		   to_list(new([2,2], float, 32, 3.5))),
+		   to_list(new_packed([2,2], float, 32, 3.5))),
      ?_assertEqual([[3.14,3.14],[3.14,3.14]], 
-		   to_list(new([2,2], float, 64, 3.14))),
+		   to_list(new_packed([2,2], float, 64, 3.14))),
      ?_assertEqual([1,1,1], fill_list(3,1)),
      ?_assertEqual([1,1,1], fill_list(3,[1])),
      ?_assertEqual([1,2,3], fill_list(3,[1,2,3])),