1--TEST--
2Random: Engine: PcgOneseq128XslRr64: Negative jumps must be rejected
3--FILE--
4<?php
5
6use Random\Engine\PcgOneseq128XslRr64;
7
8$engine = new PcgOneseq128XslRr64(1234);
9$referenceEngine = new PcgOneseq128XslRr64(1234);
10
11try {
12    $engine->jump(-1);
13} catch (ValueError $e) {
14    echo $e->getMessage(), PHP_EOL;
15}
16
17for ($i = 0; $i < 10_000; $i++) {
18    if ($engine->generate() !== $referenceEngine->generate()) {
19        die("failure: state differs at {$i}");
20    }
21}
22
23die('success');
24
25?>
26--EXPECT--
27Random\Engine\PcgOneseq128XslRr64::jump(): Argument #1 ($advance) must be greater than or equal to 0
28success
29