buildframework/helium/tools/common/python/lib/cpythontest/test_iqrf.py
author wbernard
Wed, 23 Dec 2009 19:29:07 +0200
changeset 179 d8ac696cc51f
permissions -rw-r--r--
helium_7.0-r14027
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     1
#============================================================================ 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     2
#Name        : test_iqrf.py 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     3
#Part of     : Helium 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     4
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     5
#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     6
#All rights reserved.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     7
#This component and the accompanying materials are made available
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     8
#under the terms of the License "Eclipse Public License v1.0"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     9
#which accompanies this distribution, and is available
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    10
#at the URL "http://www.eclipse.org/legal/epl-v10.html".
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    11
#
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    12
#Initial Contributors:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    13
#Nokia Corporation - initial contribution.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    14
#
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    15
#Contributors:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    16
#
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    17
#Description:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    18
#===============================================================================
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    19
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    20
""" Test cases for iqrf module. """
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    21
import unittest
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    22
import os
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    23
import imaker.iqrf
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    24
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    25
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    26
class Test_iQRF(unittest.TestCase):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    27
    """ Test for iQRF data access. """
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    28
    
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    29
    def test_file_parsing_5250(self):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    30
        """ Testing if the iqrf module is able to load the 5250 configuration. """
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    31
        root = imaker.iqrf.load(os.path.join(os.environ['HELIUM_HOME'], "tests/data/iqrf/imaker_5250.xml"))        
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    32
        assert root.result != None
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    33
        assert len(root.result.targets) == 228
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    34
        assert len(root.result.interfaces) == 1
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    35
        assert len(root.result.configurations) == 6
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    36
        
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    37
        # testing a configurations
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    38
        assert root.result.configurations[0].name == "image_conf_product52.mk"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    39
        assert root.result.configurations[0].filePath == r"\epoc32\rom\config\platform\product52\image_conf_product52.mk"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    40
        assert len(root.result.configurations[0].targetrefs) == 38
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    41
        assert root.result.configurations[0].targetrefs[0].name == "all"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    42
        
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    43
        # testing interfaces
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    44
        print "root.result.configurations[0].filePath: %s" % root.result.configurations[0].filePath
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    45
        assert len(root.result.interfaces[0].configurationElements) == 516