Files
mraa/tests/platform_checks.py
Thomas Ingleby 170bdd104f spdx: add spdx tags to most files
Large change that removes the duplicated MIT notice withe a spdx tag

Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2019-05-23 10:09:12 -07:00

36 lines
1.2 KiB
Python
Executable File

#!/usr/bin/env python
# Author: Costin Constantin <costin.c.constantin@intel.com>
# Copyright (c) 2015 Intel Corporation.
#
# SPDX-License-Identifier: MIT
from __future__ import print_function
import mraa as m
import unittest as u
@u.skipIf(m.getPlatformName() == "Unknown platform", "Not valid platform loaded")
class PlatformChecks(u.TestCase):
pass
@u.skipUnless(m.getPlatformName() == "Intel Edison", "Only for edison Board")
class PlatformChecksEdison(u.TestCase):
def test_mraa_check_platform_no_of_pins(self):
pinCount = m.getPinCount()
self.assertEqual(pinCount, 20, "Wrong number. of pins. Check platform ...")
def test_mraa_check_platform_ADC_max_resolution(self):
self.p_ADC_mres = m.adcRawBits()
print("Platform ADC max. resolution is: " + str(self.p_ADC_mres) + " bits")
self.assertEqual(self.p_ADC_mres, 12, "Wrong ADC max. resolution. Check platform ...")
def test_mraa_check_platform_ADC_resolution(self):
self.p_ADC_res = m.adcSupportedBits()
print("Platform ADC resolution is: " + str(self.p_ADC_res) + " bits")
self.assertEqual(self.p_ADC_res, 10, "Wrong ADC supported resolution. Check platform ...")
if __name__ == "__main__":
u.main()