Add verified heart pattern example
This commit is contained in:
parent
7952207735
commit
f71985c0c3
5 changed files with 97 additions and 1 deletions
|
|
@ -40,8 +40,23 @@ def main():
|
|||
with tempfile.TemporaryDirectory() as tmp:
|
||||
path=Path(tmp)/'pattern.txt';path.write_bytes(b'?##.\r\n#..?\r\n..#?\r\n')
|
||||
assert run('--radius',0,'--pattern-file',path,'--dry-run')['pattern']==pattern.split('/')
|
||||
heart_fixture=json.loads((HERE/'results/heart-5x5-example.json').read_text())
|
||||
assert (HERE/'patterns/heart-5x5.txt').read_text().splitlines()==heart_fixture['pattern']
|
||||
assert all(slime(heart_fixture['seed48'],heart_fixture['chunk_x']+dx,heart_fixture['chunk_z']+dz)==(ch=='#')
|
||||
for dz,row in enumerate(heart_fixture['pattern']) for dx,ch in enumerate(row))
|
||||
summary={'cli_scope_and_errors':True,'pattern_inputs':True}
|
||||
if args.gpu:
|
||||
heart_poc=run('--x',heart_fixture['chunk_x'],'--z',heart_fixture['chunk_z'],'--radius',0,
|
||||
'--pattern-file',HERE/'patterns/heart-5x5.txt','--max-results',2000)
|
||||
heart_hits=heart_poc['rounds'][0]
|
||||
assert heart_hits['matches']==heart_fixture['single_anchor']['matches']
|
||||
assert heart_hits['root_jobs']==heart_fixture['single_anchor']['root_jobs']
|
||||
assert not heart_hits['sample_truncated'] and len(heart_hits['sample'])==heart_hits['matches']
|
||||
assert len(set(map(tuple,heart_hits['sample'])))==heart_hits['matches']
|
||||
assert [heart_fixture['seed48'],heart_fixture['chunk_x'],heart_fixture['chunk_z']] in heart_hits['sample']
|
||||
for seed,x,z in heart_hits['sample']:
|
||||
assert all(slime(seed,x+dx,z+dz)==(ch=='#') for dz,row in enumerate(heart_fixture['pattern']) for dx,ch in enumerate(row))
|
||||
summary['heart_pattern_verified_matches']=heart_hits['matches']
|
||||
# A mixed-mask regression fixture; this is not the target creeper pattern.
|
||||
fixture=json.loads((HERE/'testdata/mixed-mask-regression.json').read_text())
|
||||
face=run('--x',fixture['chunk_x'],'--z',fixture['chunk_z'],'--radius',0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue