adds tests for crc
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
from .sgp30 import Sgp30
|
from .sgp30 import Sgp30
|
||||||
|
from .crc import Crc8
|
||||||
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
7
tests/context.py
Normal file
7
tests/context.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||||
|
|
||||||
|
import sgp30
|
10
tests/test_crc.py
Normal file
10
tests/test_crc.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
from .context import sgp30
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
class BasicTestSuite(unittest.TestCase):
|
||||||
|
"""Basic test cases."""
|
||||||
|
def test_absolute_truth_and_meaning(self):
|
||||||
|
self.assertEqual(sgp30.Crc8().hash([0xBE, 0xEF]), 0x92,"testing doccumentation example")
|
||||||
|
self.assertEqual(sgp30.Crc8().hash([1,144]), 76, "First half of default reading")
|
||||||
|
self.assertEqual(sgp30.Crc8().hash([0,6]), 39, "second half of default reading, ")
|
||||||
|
|
Reference in New Issue
Block a user