diff options
| author | Daniel Campora | 2015-09-27 17:04:49 +0200 |
|---|---|---|
| committer | Daniel Campora | 2015-09-27 17:35:58 +0200 |
| commit | 37a2015cc541bbc27099a09ff0bffd61bb8ccc01 (patch) | |
| tree | 48920fe3dc4a6e5806cd9745c83609e066b30c61 /tests | |
| parent | 958e273336644833de52c91ffee67b91493bb403 (diff) | |
tests/wipy: Add machine module tests.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/wipy/wlan/machine.py | 42 | ||||
| -rw-r--r-- | tests/wipy/wlan/machine.py.exp | 7 | ||||
| -rw-r--r-- | tests/wipy/wlan/wlan.py | 2 | ||||
| -rw-r--r-- | tests/wipy/wlan/wlan.py.exp | 1 |
4 files changed, 52 insertions, 0 deletions
diff --git a/tests/wipy/wlan/machine.py b/tests/wipy/wlan/machine.py new file mode 100644 index 000000000..2ee529965 --- /dev/null +++ b/tests/wipy/wlan/machine.py @@ -0,0 +1,42 @@ +''' +machine test for the CC3200 based boards. +''' + +import machine +import os +from network import WLAN + +mch = os.uname().machine +if not 'LaunchPad' in mch and not'WiPy' in mch: + raise Exception('Board not supported!') + +wifi = WLAN() + +print(machine) +machine.idle() +print(machine.freq() == (80000000,)) +print(machine.unique_id() == wifi.mac()) + +machine.main('main.py') + +rand_nums = [] +for i in range(0, 100): + rand = machine.rng() + if rand not in rand_nums: + rand_nums.append(rand) + else: + print('RNG number repeated') + break + +for i in range(0, 10): + machine.idle() + +print("Active") + +print(machine.reset_cause() >= 0) +print(machine.wake_reason() >= 0) + +try: + machine.main(123456) +except: + print('Exception') diff --git a/tests/wipy/wlan/machine.py.exp b/tests/wipy/wlan/machine.py.exp new file mode 100644 index 000000000..303a0633a --- /dev/null +++ b/tests/wipy/wlan/machine.py.exp @@ -0,0 +1,7 @@ +<module 'machine'> +True +True +Active +True +True +Exception diff --git a/tests/wipy/wlan/wlan.py b/tests/wipy/wlan/wlan.py index 8d2537511..922cb5dc6 100644 --- a/tests/wipy/wlan/wlan.py +++ b/tests/wipy/wlan/wlan.py @@ -97,6 +97,8 @@ print(wifi.isconnected() == False) # test init again wifi.init(WLAN.AP, ssid='www.wipy.io', auth=None, channel=5, antenna=WLAN.INT_ANT) +print(len(wlan.mac()) == 6) + # next ones MUST raise try: wifi.init(mode=12345) diff --git a/tests/wipy/wlan/wlan.py.exp b/tests/wipy/wlan/wlan.py.exp index 407c31db9..6d27bb31c 100644 --- a/tests/wipy/wlan/wlan.py.exp +++ b/tests/wipy/wlan/wlan.py.exp @@ -32,6 +32,7 @@ True True True True +True Exception Exception Exception |
