assertEquals($result, $expect); } /** * @see testAggregateTupleCounts */ public function provideAggregateTupleCounts() { return [ ['5*10:foo*2:14*100::bar*7', 119], // Test with tuples without explicit count (implicit count of 1) ['5:foo:14::bar', 4], ['5*10:foo:14*100', 111], ['key1:key2:key3', 3], ['', 0], ['single', 1], ]; } /** * @dataProvider provideAggregateTupleCounts */ public function testAggregateTupleCounts($record, $expected) { $result = TupleOps::aggregateTupleCounts($record); $this->assertEquals($expected, $result); } /** * @see testParseTuples */ public function provideParseTuples() { return [ // Original test case [ '5*10:foo*2:14*100::bar*7', [5 => 'first', 'bar' => 'second', 'foo' => null], ['first' => 10, 'second' => 7] ], // Test with tuples without explicit count (implicit count of 1) [ '5:foo:14::bar', [5 => 'first', 'bar' => 'second', 'foo' => null], ['first' => 1, 'second' => 1] ], // Mixed: some with count, some without [ '5*10:foo:14*100', [5 => 'first', 'foo' => 'second', 14 => 'third'], ['first' => 10, 'second' => 1, 'third' => 100] ], // No filter map (returns all with original keys) [ '5*10:foo*2:bar', null, [5 => 10, 'foo' => 2, 'bar' => 1] ], // Empty record [ '', [5 => 'first'], [] ], ]; } /** * @dataProvider provideParseTuples */ public function testParseTuples($record, $keys, $expect) { $result = TupleOps::parseTuples($record, $keys); $this->assertEquals($expect, $result); } }