Skip to content

Commit

Permalink
Merge pull request #102 from aaronhuisinga/master
Browse files Browse the repository at this point in the history
Add test file for DBase 7 Double type
  • Loading branch information
gam6itko authored Feb 17, 2021
2 parents bc5cdf2 + faffe70 commit 8029865
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/XBase/Record/DBase7Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,12 @@ public function getInt(string $columnName): int
{
return $this->get($columnName);
}

/**
* @deprecated since 1.3 and will be delete in 2.0. Use get()
*/
public function getDouble(string $columnName): float
{
return $this->get($columnName);
}
}
14 changes: 14 additions & 0 deletions tests/DBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,20 @@ public function testDbase7int(): void
self::assertSame(2147483647, $table->nextRecord()->getInt('int'));
self::assertSame(-2147483647, $table->nextRecord()->getInt('int'));
}

public function testDbase7double(): void
{
$table = new Table(__DIR__.'/Resources/dBase/dBaseVII_double.dbf');
self::assertSame(1, $table->getColumnCount());
self::assertSame(5, $table->getRecordCount());
self::assertSame(TableType::DBASE_7_NOMEMO, $table->getVersion());

self::assertSame(-199.99, $table->nextRecord()->getDouble('double'));
self::assertSame(-74.62, $table->nextRecord()->getDouble('double'));
self::assertSame(43.65, $table->nextRecord()->getDouble('double'));
self::assertSame(150.48, $table->nextRecord()->getDouble('double'));
self::assertSame(0.0, $table->nextRecord()->getDouble('double'));
}

protected function assertMemoImg(Table $table)
{
Expand Down
Binary file added tests/Resources/dBase/dBaseVII_double.dbf
Binary file not shown.

0 comments on commit 8029865

Please sign in to comment.