@@ -193,7 +193,7 @@ defmodule SqlitexTest do
193193 test "decimal types" do
194194 { :ok , db } = Sqlitex . open ( ":memory:" )
195195 :ok = Sqlitex . exec ( db , "CREATE TABLE t (f DECIMAL)" )
196- d = Decimal . new ( 1.123 )
196+ d = Decimal . new ( " 1.123" )
197197 { :ok , [ ] } = Sqlitex . query ( db , "INSERT INTO t VALUES (?)" , bind: [ d ] )
198198 { :ok , [ row ] } = Sqlitex . query ( db , "SELECT f FROM t" )
199199 assert row [ :f ] == d
@@ -202,14 +202,14 @@ defmodule SqlitexTest do
202202 test "decimal types with scale and precision" do
203203 { :ok , db } = Sqlitex . open ( ":memory:" )
204204 :ok = Sqlitex . exec ( db , "CREATE TABLE t (id INTEGER, f DECIMAL(3,2))" )
205- { :ok , [ ] } = Sqlitex . query ( db , "INSERT INTO t VALUES (?,?)" , bind: [ 1 , Decimal . new ( 1.123 ) ] )
206- { :ok , [ ] } = Sqlitex . query ( db , "INSERT INTO t VALUES (?,?)" , bind: [ 2 , Decimal . new ( 244.37 ) ] )
207- { :ok , [ ] } = Sqlitex . query ( db , "INSERT INTO t VALUES (?,?)" , bind: [ 3 , Decimal . new ( 1997 ) ] )
205+ { :ok , [ ] } = Sqlitex . query ( db , "INSERT INTO t VALUES (?,?)" , bind: [ 1 , Decimal . new ( " 1.123" ) ] )
206+ { :ok , [ ] } = Sqlitex . query ( db , "INSERT INTO t VALUES (?,?)" , bind: [ 2 , Decimal . new ( " 244.37" ) ] )
207+ { :ok , [ ] } = Sqlitex . query ( db , "INSERT INTO t VALUES (?,?)" , bind: [ 3 , Decimal . new ( " 1997" ) ] )
208208
209209 # results should be truncated to the appropriate precision and scale:
210210 Sqlitex . query! ( db , "SELECT f FROM t ORDER BY id" )
211211 |> Enum . map ( fn row -> row [ :f ] end )
212- |> Enum . zip ( [ Decimal . new ( 1.12 ) , Decimal . new ( 244 ) , Decimal . new ( 1990 ) ] )
212+ |> Enum . zip ( [ Decimal . new ( " 1.12" ) , Decimal . new ( 244 ) , Decimal . new ( 1990 ) ] )
213213 |> Enum . each ( fn { res , ans } -> assert Decimal . equal? ( res , ans ) end )
214214 end
215215
0 commit comments