dhgdh
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
mbd_os/tools/compliance/ioper_base.py@1:55a6170b404f, 2016-09-17 (annotated)
- Committer:
- nexpaq
- Date:
- Sat Sep 17 16:32:05 2016 +0000
- Revision:
- 1:55a6170b404f
checking in for sharing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nexpaq | 1:55a6170b404f | 1 | """ |
nexpaq | 1:55a6170b404f | 2 | mbed SDK |
nexpaq | 1:55a6170b404f | 3 | Copyright (c) 2011-2015 ARM Limited |
nexpaq | 1:55a6170b404f | 4 | |
nexpaq | 1:55a6170b404f | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
nexpaq | 1:55a6170b404f | 6 | you may not use this file except in compliance with the License. |
nexpaq | 1:55a6170b404f | 7 | You may obtain a copy of the License at |
nexpaq | 1:55a6170b404f | 8 | |
nexpaq | 1:55a6170b404f | 9 | http://www.apache.org/licenses/LICENSE-2.0 |
nexpaq | 1:55a6170b404f | 10 | |
nexpaq | 1:55a6170b404f | 11 | Unless required by applicable law or agreed to in writing, software |
nexpaq | 1:55a6170b404f | 12 | distributed under the License is distributed on an "AS IS" BASIS, |
nexpaq | 1:55a6170b404f | 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
nexpaq | 1:55a6170b404f | 14 | See the License for the specific language governing permissions and |
nexpaq | 1:55a6170b404f | 15 | limitations under the License. |
nexpaq | 1:55a6170b404f | 16 | |
nexpaq | 1:55a6170b404f | 17 | Author: Przemyslaw Wirkus <Przemyslaw.Wirkus@arm.com> |
nexpaq | 1:55a6170b404f | 18 | |
nexpaq | 1:55a6170b404f | 19 | """ |
nexpaq | 1:55a6170b404f | 20 | |
nexpaq | 1:55a6170b404f | 21 | import sys |
nexpaq | 1:55a6170b404f | 22 | |
nexpaq | 1:55a6170b404f | 23 | try: |
nexpaq | 1:55a6170b404f | 24 | from colorama import Fore |
nexpaq | 1:55a6170b404f | 25 | except: |
nexpaq | 1:55a6170b404f | 26 | pass |
nexpaq | 1:55a6170b404f | 27 | |
nexpaq | 1:55a6170b404f | 28 | COLORAMA = 'colorama' in sys.modules |
nexpaq | 1:55a6170b404f | 29 | |
nexpaq | 1:55a6170b404f | 30 | |
nexpaq | 1:55a6170b404f | 31 | class IOperTestCaseBase(): |
nexpaq | 1:55a6170b404f | 32 | """ Interoperability test case base class |
nexpaq | 1:55a6170b404f | 33 | @return list of tuple (severity, Description) |
nexpaq | 1:55a6170b404f | 34 | Example: (result.append((IOperTestSeverity.INFO, "")) |
nexpaq | 1:55a6170b404f | 35 | """ |
nexpaq | 1:55a6170b404f | 36 | |
nexpaq | 1:55a6170b404f | 37 | def __init__(self, scope=None): |
nexpaq | 1:55a6170b404f | 38 | self.PASS = 'PASS' |
nexpaq | 1:55a6170b404f | 39 | self.INFO = 'INFO' |
nexpaq | 1:55a6170b404f | 40 | self.ERROR = 'ERROR' |
nexpaq | 1:55a6170b404f | 41 | self.WARN = 'WARN' |
nexpaq | 1:55a6170b404f | 42 | |
nexpaq | 1:55a6170b404f | 43 | self.scope = scope # Default test scope (basic, pedantic, mbed-enabled etc...) |
nexpaq | 1:55a6170b404f | 44 | |
nexpaq | 1:55a6170b404f | 45 | def test(self, param=None): |
nexpaq | 1:55a6170b404f | 46 | result = [] |
nexpaq | 1:55a6170b404f | 47 | return result |
nexpaq | 1:55a6170b404f | 48 | |
nexpaq | 1:55a6170b404f | 49 | def RED(self, text): |
nexpaq | 1:55a6170b404f | 50 | return self.color_text(text, color=Fore.RED, delim=Fore.RESET) if COLORAMA else text |
nexpaq | 1:55a6170b404f | 51 | |
nexpaq | 1:55a6170b404f | 52 | def GREEN(self, text): |
nexpaq | 1:55a6170b404f | 53 | return self.color_text(text, color=Fore.GREEN, delim=Fore.RESET) if COLORAMA else text |
nexpaq | 1:55a6170b404f | 54 | |
nexpaq | 1:55a6170b404f | 55 | def YELLOW(self, text): |
nexpaq | 1:55a6170b404f | 56 | return self.color_text(text, color=Fore.YELLOW, delim=Fore.RESET) if COLORAMA else text |
nexpaq | 1:55a6170b404f | 57 | |
nexpaq | 1:55a6170b404f | 58 | def color_text(self, text, color='', delim=''): |
nexpaq | 1:55a6170b404f | 59 | return color + text + color + delim |
nexpaq | 1:55a6170b404f | 60 | |
nexpaq | 1:55a6170b404f | 61 | def COLOR(self, severity, text): |
nexpaq | 1:55a6170b404f | 62 | colors = { |
nexpaq | 1:55a6170b404f | 63 | self.PASS : self.GREEN, |
nexpaq | 1:55a6170b404f | 64 | self.ERROR : self.RED, |
nexpaq | 1:55a6170b404f | 65 | self.WARN : self.YELLOW |
nexpaq | 1:55a6170b404f | 66 | } |
nexpaq | 1:55a6170b404f | 67 | if severity in colors: |
nexpaq | 1:55a6170b404f | 68 | return colors[severity](text) |
nexpaq | 1:55a6170b404f | 69 | return text |