Put simulation code into separate module
This commit is contained in:
@@ -1,25 +1,7 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
|
||||
from utility import simulation, noise, codes
|
||||
|
||||
|
||||
class CountBitErrorsTestCase(unittest.TestCase):
|
||||
"""Test case for bit error counting."""
|
||||
|
||||
def test_count_bit_errors(self):
|
||||
d1 = np.array([0, 0, 0, 0])
|
||||
y_hat1 = np.array([0, 1, 0, 1])
|
||||
|
||||
d2 = np.array([0, 0, 0, 0])
|
||||
y_hat2 = np.array([0, 0, 0, 0])
|
||||
|
||||
d3 = np.array([0, 0, 0, 0])
|
||||
y_hat3 = np.array([1, 1, 1, 1])
|
||||
|
||||
self.assertEqual(simulation.count_bit_errors(d1, y_hat1), 2)
|
||||
self.assertEqual(simulation.count_bit_errors(d2, y_hat2), 0)
|
||||
self.assertEqual(simulation.count_bit_errors(d3, y_hat3), 4)
|
||||
from utility import noise, codes
|
||||
|
||||
|
||||
# TODO: Rewrite tests for new SNR calculation
|
||||
|
||||
Reference in New Issue
Block a user