Skip to content

Commit 3b08a46

Browse files
committed
add tests for int128
1 parent 45605d5 commit 3b08a46

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

tests/int128Test.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase;
4+
use MonetDB\Connection;
5+
6+
require_once(__DIR__. '../../src/include.php');
7+
8+
final class int128Test extends TestCase {
9+
public $conn;
10+
11+
public function setUp(): void
12+
{
13+
$this->conn = new Connection("127.0.0.1", 50000, "monetdb", "monetdb", "temp");
14+
}
15+
16+
public function testStartTransaction(): void
17+
{
18+
$res = $this->conn->Query("START TRANSACTION");
19+
20+
$this->assertCount(0, $res);
21+
}
22+
23+
public function testBigIntTable(): void
24+
{
25+
$res = $this->conn->Query("CREATE TABLE php_int128 (i HUGEINT);");
26+
27+
$this->assertCount(0, $res);
28+
}
29+
30+
public function testInsertBigInt(): void
31+
{
32+
$res = $this->conn->Query("INSERT INTO php_int128 VALUES (123456789098765432101234567890987654321);");
33+
34+
$this->assertCount(0, $res);
35+
}
36+
37+
public function testSelectBigInt(): void
38+
{
39+
$res = $this->conn->Query("SELECT * FROM php_int128");
40+
$res_arr = iterator_to_array($res);
41+
42+
$this->assertEquals($res_arr[1]["i"], "123456789098765432101234567890987654321");
43+
}
44+
45+
}
46+
?>

0 commit comments

Comments
 (0)