Skip to content

Commit

Permalink
Add test for all unsigned integers
Browse files Browse the repository at this point in the history
  • Loading branch information
ben221199 committed Feb 20, 2025
1 parent fc406c2 commit e3d1cde
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/Fields/UnsignedInteger16Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ public function testDeserializeFromPresentationFormat(): void{
self::assertSame(65535,UnsignedInteger16::deserializeFromPresentationFormat('65535')->getValue());
}

/**
* @return void
* @throws DNSFieldException
*/
public function testDeserializeFromPresentationFormatNoInteger(): void{
self::expectException(DNSFieldException::class);
self::expectExceptionMessage('Human readable UInt16 should only contain digits.');

UnsignedInteger16::deserializeFromPresentationFormat('abc');
}

/**
* @return void
* @throws DNSFieldException
Expand Down
11 changes: 11 additions & 0 deletions tests/Fields/UnsignedInteger32Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ public function testDeserializeFromPresentationFormat(): void{
self::assertSame(4294967295,UnsignedInteger32::deserializeFromPresentationFormat('4294967295')->getValue());
}

/**
* @return void
* @throws DNSFieldException
*/
public function testDeserializeFromPresentationFormatNoInteger(): void{
self::expectException(DNSFieldException::class);
self::expectExceptionMessage('Human readable UInt32 should only contain digits.');

UnsignedInteger32::deserializeFromPresentationFormat('abc');
}

/**
* @return void
* @throws DNSFieldException
Expand Down
11 changes: 11 additions & 0 deletions tests/Fields/UnsignedInteger8Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ public function testDeserializeFromPresentationFormat(): void{
self::assertSame(255,UnsignedInteger8::deserializeFromPresentationFormat('255')->getValue());
}

/**
* @return void
* @throws DNSFieldException
*/
public function testDeserializeFromPresentationFormatNoInteger(): void{
self::expectException(DNSFieldException::class);
self::expectExceptionMessage('Human readable UInt8 should only contain digits.');

UnsignedInteger8::deserializeFromPresentationFormat('abc');
}

/**
* @return void
* @throws DNSFieldException
Expand Down

0 comments on commit e3d1cde

Please sign in to comment.