File: 31_bind_weird_number_param.t

package info (click to toggle)
libdbd-sqlite3-perl 1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,004 kB
  • sloc: ansic: 167,715; perl: 1,788; pascal: 277; makefile: 9
file content (24 lines) | stat: -rw-r--r-- 631 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;
my @to_be_tested;
BEGIN { @to_be_tested = (1.23E4); }

use Test::More;
use lib "t/lib";
use SQLiteTest;
use if -d ".git", "Test::FailWarnings";

my $dbh = connect_ok();

ok( $dbh->do("CREATE TABLE f (id, num)"), 'CREATE TABLE f' );

SCOPE: {
    my $sth = $dbh->prepare("INSERT INTO f VALUES (?, ?)");
    for(my $id = 0; $id < @to_be_tested; $id++) {
        $sth->execute($id, $to_be_tested[$id]);
        my $av = $dbh->selectrow_arrayref("SELECT num FROM f WHERE id = ?", {}, $id);
        ok( (@$av && $av->[0] == $to_be_tested[$id]), "accepts $to_be_tested[$id]: ".$av->[0]);
    }
}

done_testing;