Changeset View
Changeset View
Standalone View
Standalone View
tests/Strings/Multibyte/OmniStringTest.php
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | public function testEndsWith () : void { | ||||
$this->assertFalse($this->string->endsWith("oO")); | $this->assertFalse($this->string->endsWith("oO")); | ||||
$this->assertFalse($this->string->endsWith("bar")); | $this->assertFalse($this->string->endsWith("bar")); | ||||
} | } | ||||
public function testLen () : void { | public function testLen () : void { | ||||
$this->assertEquals(3, $this->string->len()); | $this->assertEquals(3, $this->string->len()); | ||||
} | } | ||||
/** | |||||
* @dataProvider provideCharactersArrays | |||||
*/ | |||||
public function testGetChars (string $string, array $expectedCharacters) : void { | |||||
$actualCharacters = (new OmniString($string))->getChars(); | |||||
$this->assertEquals($expectedCharacters, $actualCharacters); | |||||
} | |||||
/** | |||||
* @dataProvider provideCharactersBigrams | |||||
*/ | |||||
public function testBigrams (string $string, array $expectedBigrams) : void { | |||||
$actualBigrams = (new OmniString($string))->getBigrams(); | |||||
$this->assertEquals($expectedBigrams, $actualBigrams); | |||||
} | |||||
/// | |||||
/// Data providers | |||||
/// | |||||
public function provideCharactersArrays () : iterable { | |||||
yield ["foo", ['f', 'o', 'o']]; | |||||
yield [ | |||||
'àèòàFOOàèòà', | |||||
['à', 'è', 'ò', 'à', 'F', 'O', 'O', 'à', 'è', 'ò', 'à'] | |||||
]; | |||||
yield ["🇩🇪", ["🇩", "🇪"]]; | |||||
yield ["", []]; | |||||
} | |||||
public function provideCharactersBigrams () : iterable { | |||||
yield ["foo", ['fo', 'oo']]; | |||||
yield ["night", ['ni', 'ig', 'gh', 'ht']]; | |||||
yield ["🇩🇪", ["🇩🇪"]]; | |||||
yield ["", []]; | |||||
} | |||||
} | } |
Nasqueron DevCentral · If it had been much bigger the moon would have had a core of ice. · Powered by Phabricator