public void LFSR_Logic_Engine_Works() { LFSR lfsr = new LFSR(); lfsr.Init("1011", "11001"); string result = lfsr.GetOutput("", -1); Assert.AreEqual("0110", result); lfsr.Init("11101", "110111"); result = lfsr.GetOutput("", -1); Assert.AreEqual("11010", result); }
public void LFSR_Logic_Initialization() { LFSR lfsr = new LFSR(); lfsr.Init("1011", "1101"); Assert.AreEqual("1011", lfsr.Seed); Assert.AreEqual("1101", lfsr.Polynomial); }
public void LFSR_Shift_Works() { LFSR lfsr = new LFSR(); lfsr.Init("1011", "11001"); Assert.AreEqual(2, lfsr.Shift(4)); }
public void LFSR_Logic_XOR_Returns_1() { LFSR lfsr = new LFSR(); lfsr.Init("1011", "11001"); Assert.AreEqual(1, lfsr.XORBits(5)); Assert.AreEqual(1, lfsr.XORBits(10)); }
public void LSFR_Logic_Bit_Replacing_Works() { LFSR lfsr = new LFSR(); lfsr.Init("1011", "11001"); Assert.AreEqual(15, lfsr.ReplaceFirstBit(7, 1)); Assert.AreEqual(0, lfsr.ReplaceFirstBit(8, 0)); Assert.AreEqual(3, lfsr.ReplaceFirstBit(11, 0)); }
public void LFSR_Logic_XOR_Returns_0() { LFSR lfsr = new LFSR(); lfsr.Init("1011", "11001"); Assert.AreEqual(0, lfsr.XORBits(11)); Assert.AreEqual(0, lfsr.XORBits(13)); Assert.AreEqual(0, lfsr.XORBits(29)); }