package ru.r2cloud.jradio.demod;

import static org.junit.Assert.assertEquals;

import java.io.IOException;

import org.junit.Test;

import ru.r2cloud.jradio.ByteInput;
import ru.r2cloud.jradio.blocks.HardToSoft;

public class AbstractBerTest {

	@Test
	public void test() throws IOException {
		NoOpBer ber = new NoOpBer();
		assertEquals(0.0, ber.calculateBer(0.0f), 0.0000001);
	}

	private static class NoOpBer extends AbstractBer {

		@Override
		public ByteInput createModulatorDemodulator(ByteInput input, float ebno) {
			return new HardToSoft(input);
		}

	}
	
}

@@ -191,24 +191,14 @@
 dio.
-blocks.HardToSof
+Contex
 t;%0A%0A
@@ -528,35 +528,642 @@
 new 
-HardToSoft(input);%0A%09%09%7D%0A%0A%09%7D%0A%09
+UnpackedToSoft(input);%0A%09%09%7D%0A%0A%09%7D%0A%0A%09private static class UnpackedToSoft implements ByteInput %7B%0A%0A%09%09private final ByteInput input;%0A%09%09private final Context ctx;%0A%0A%09%09public UnpackedToSoft(ByteInput input) %7B%0A%09%09%09this.input = input;%0A%09%09%09this.ctx = new Context(input.getContext());%0A%09%09%09this.ctx.setSoftBits(true);%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public void close() throws IOException %7B%0A%09%09%09input.close();%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public byte readByte() throws IOException %7B%0A%09%09%09byte bit = input.readByte();%0A%09%09%09if (bit == 0) %7B%0A%09%09%09%09return Byte.MIN_VALUE;%0A%09%09%09%7D else %7B%0A%09%09%09%09return Byte.MAX_VALUE;%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public Context getContext() %7B%0A%09%09%09return ctx;%0A%09%09%7D%0A%0A%09%7D%0A
 %0A%7D%0A

fix test