Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cmatosbc committed Nov 28, 2024
1 parent bff1dac commit cbf2181
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/PerformanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PerformanceTest extends TestCase
private string $transformFile;
private string $outputFile;
private int $fileSize = 100 * 1024 * 1024; // 100MB for regular tests
private int $transformFileSize = 1 * 1024 * 1024; // 1MB for transform tests
private int $transformFileSize = 10 * 1024 * 1024; // 10MB for transform tests
private int $chunkSize = 8192; // 8KB chunks

protected function setUp(): void
Expand Down Expand Up @@ -91,9 +91,14 @@ public function testTransformReadPerformance()
{
$handler = new AsyncFileHandler($this->transformFile, 'r', $this->chunkSize);

// Set up whitespace removal transformation
// Set up handler with a more complex transformation
$handler->setTransformCallable(function(string $chunk): string {
return preg_replace('/\s+/', '', $chunk);
// More complex transformation that simulates real-world processing
$chunk = preg_replace('/\s+/', '', $chunk); // Remove whitespace
$chunk = str_rot13($chunk); // Apply ROT13 encoding
$chunk = base64_encode($chunk); // Base64 encode
$chunk = strtr($chunk, '+/', '-_'); // URL-safe base64
return $chunk;
});

// Measure sync read with transform
Expand Down

0 comments on commit cbf2181

Please sign in to comment.