mbed-os for GR-LYCHEE

Dependents:   mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more

Committer:
dkato
Date:
Fri Feb 02 05:42:23 2018 +0000
Revision:
0:f782d9c66c49
mbed-os for GR-LYCHEE

Who changed what in which revision?

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