()
| 728 | |
| 729 | |
| 730 | def test_model_mod1(): |
| 731 | model = constriction.stream.model.QuantizedGaussian(-100, 100, 12.6, 7.3) |
| 732 | |
| 733 | # Encode and decode an example message: |
| 734 | symbols = np.array([12, 15, 4, -2, 18, 5], dtype=np.int32) |
| 735 | coder = constriction.stream.stack.AnsCoder() # (RangeEncoder also works) |
| 736 | coder.encode_reverse(symbols, model) |
| 737 | assert np.all(coder.get_compressed() == np.array( |
| 738 | [745994372, 25704], dtype=np.uint32)) |
| 739 | |
| 740 | reconstructed = coder.decode(model, 6) # (decodes 6 i.i.d. symbols) |
| 741 | assert np.all(reconstructed == symbols) # (verify correctness) |
| 742 | |
| 743 | |
| 744 | def test_model_mod2(): |
nothing calls this directly
no test coverage detected