1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-07 14:19:10 -04:00

more tests

This commit is contained in:
Kenichi Ishigaki 2010-06-17 03:39:47 +00:00
parent 83a204db9e
commit a53e2df1cb

View file

@ -18,7 +18,7 @@ my @values = qw/
00002.000
test 01234test -test +test
0.123e 0.123e+
0. .123
0. .123 -.123 +.123
-1 -1.0 -1.0e-001 -0000 -0101 -002.00
+1 +1.0 +1.0e-001 +0000 +0101 +002.00
1234567890123456789012345678901234567890
@ -31,15 +31,20 @@ my @values = qw/
-2147483646 +2147483647
-2147483647 +2147483648
-2147483648 +2147483649
+ -
/;
plan tests => @values * 3 + 1;
my @types = ('', 'text', 'integer', 'float');
# no type specification
plan tests => @values * 3 * @types + 1;
for my $type (@types) {
my $typename = $type || 'default';
for my $value (@values) {
my $dbh = connect_ok( RaiseError => 1, AutoCommit => 1 );
$dbh->do('create table foo (string)');
ok $dbh->do('insert into foo values(?)', undef, $value), "inserting $value";
my ($got) = $dbh->selectrow_array('select string from foo where string = ?', undef, $value);
ok defined $got && $got eq $value, "got: $got expected: $value";
$dbh->do("create table foo (value $type)");
ok $dbh->do('insert into foo values(?)', undef, $value), "inserting $value into a $typename column";
my ($got) = $dbh->selectrow_array('select value from foo where value = ?', undef, $value);
ok defined $got && $got eq $value, "type: $typename got: $got expected: $value";
}
}