apicompatanamdw/bcdrivers/os/lbs/LocAcquisition/src/testcourse.cpp
changeset 2 0cb2248d0edc
equal deleted inserted replaced
1:61e9400fe245 2:0cb2248d0edc
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Helper class for TCourse class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // System Includes
       
    20 
       
    21 
       
    22 // User Includes
       
    23 #include "testcourse.h"
       
    24 #include <e32std.h>
       
    25 
       
    26 // Constant Declarations
       
    27 
       
    28     
       
    29 // ======== MEMBER FUNCTIONS ========
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // C++ Default Constructor
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 TTestCourse ::TTestCourse (CStifLogger* aLog):iLog(aLog)
       
    36     {
       
    37         
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // C++ Destructor
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 TTestCourse ::~TTestCourse ()
       
    45     {
       
    46         
       
    47     }
       
    48 
       
    49 
       
    50 // ---------------------------------------------------------
       
    51 //  Test case for Default Constructor of TCourse
       
    52 // ---------------------------------------------------------
       
    53 //	
       
    54 TInt TTestCourse :: DefaultConstructor()
       
    55     {
       
    56 	TCourse course;
       
    57 	
       
    58     return KErrNone;
       
    59     }
       
    60 
       
    61 // ---------------------------------------------------------
       
    62 //  Test case for setting & getting the speed
       
    63 // ---------------------------------------------------------   
       
    64  TInt TTestCourse ::SetGetSpeed(CStifItemParser& aItem)
       
    65     {
       
    66         TCourse course;
       
    67         TInt speed = 0;
       
    68         TInt error = aItem.GetNextInt(speed);
       
    69         TReal32 speed1 = static_cast<TReal32>(speed);
       
    70         if(!error)
       
    71             {
       
    72                 course.SetSpeed(speed1);
       
    73                 if(course.Speed()==speed1)
       
    74                     {
       
    75                         return KErrNone;
       
    76                         
       
    77                     }
       
    78                 else
       
    79                     return KErrGeneral;
       
    80                 
       
    81             }
       
    82          else
       
    83             return KErrGeneral;
       
    84     }
       
    85 // ---------------------------------------------------------
       
    86 //  Test case for setting & getting the heading
       
    87 // ---------------------------------------------------------   
       
    88 
       
    89 
       
    90 TInt TTestCourse :: SetGetHeading(CStifItemParser& aItem)
       
    91     {
       
    92         TCourse course;
       
    93         TInt heading = 0;
       
    94         TInt error = aItem.GetNextInt(heading);
       
    95         TReal32 heading1 = static_cast<TReal32>(heading);
       
    96         if(!error)
       
    97             {
       
    98                 course.SetHeading(heading1);
       
    99                 if(course.Heading()==heading1)
       
   100                     {
       
   101                         return KErrNone;
       
   102                         
       
   103                     }
       
   104                 else
       
   105                     return KErrGeneral;
       
   106                 
       
   107             }
       
   108          else
       
   109             return KErrGeneral;
       
   110     }
       
   111     
       
   112 // ---------------------------------------------------------
       
   113 //  Test case for setting & getting the course
       
   114 // ---------------------------------------------------------   
       
   115 
       
   116 
       
   117 TInt TTestCourse :: SetGetCourse(CStifItemParser& aItem)
       
   118     {
       
   119         TCourse course_obj;
       
   120         TInt course = 0;
       
   121         TInt error = aItem.GetNextInt(course);
       
   122         TReal32 course1 = static_cast<TReal32>(course);
       
   123         if(!error)
       
   124             {
       
   125                 course_obj.SetCourse(course1);
       
   126                 if(course_obj.Course()==course1)
       
   127                     {
       
   128                         return KErrNone;
       
   129                         
       
   130                     }
       
   131                 else
       
   132                     return KErrGeneral;
       
   133                 
       
   134             }
       
   135          else
       
   136             return KErrGeneral;
       
   137     }
       
   138     
       
   139     
       
   140 // ---------------------------------------------------------
       
   141 //  Test case for setting & getting the speed accuracy
       
   142 // ---------------------------------------------------------   
       
   143 
       
   144 
       
   145 TInt TTestCourse :: SetGetSpeedAcc(CStifItemParser& aItem)
       
   146     {
       
   147         TCourse course_obj;
       
   148         TInt speed_acc = 0;
       
   149         TInt error = aItem.GetNextInt(speed_acc);
       
   150         TReal32 speed_acc1 = static_cast<TReal32>(speed_acc);
       
   151         if(!error)
       
   152             {
       
   153                 course_obj.SetSpeedAccuracy(speed_acc1);
       
   154                 if(course_obj.SpeedAccuracy()==speed_acc1)
       
   155                     {
       
   156                         return KErrNone;
       
   157                         
       
   158                     }
       
   159                 else
       
   160                     return KErrGeneral;
       
   161                 
       
   162             }
       
   163          else
       
   164             return KErrGeneral;
       
   165     }
       
   166     
       
   167 // ---------------------------------------------------------
       
   168 //  Test case for setting & getting the heading accuracy
       
   169 // ---------------------------------------------------------   
       
   170 
       
   171 
       
   172 TInt TTestCourse :: SetGetHeadingAcc(CStifItemParser& aItem)
       
   173     {
       
   174         TCourse course_obj;
       
   175         TInt heading_acc = 0;
       
   176         TInt error = aItem.GetNextInt(heading_acc);
       
   177         TReal32 heading_acc1 = static_cast<TReal32>(heading_acc);
       
   178         if(!error)
       
   179             {
       
   180                 course_obj.SetHeadingAccuracy(heading_acc1);
       
   181                 if(course_obj.HeadingAccuracy()==heading_acc1)
       
   182                     {
       
   183                         return KErrNone;
       
   184                         
       
   185                     }
       
   186                 else
       
   187                     return KErrGeneral;
       
   188                 
       
   189             }
       
   190          else
       
   191             return KErrGeneral;
       
   192     }
       
   193     
       
   194     
       
   195 // ---------------------------------------------------------
       
   196 //  Test case for setting & getting the course accuracy
       
   197 // ---------------------------------------------------------   
       
   198 
       
   199 
       
   200 TInt TTestCourse :: SetGetCourseAcc(CStifItemParser& aItem)
       
   201     {
       
   202         TCourse course_obj;
       
   203         TInt course_acc = 0;
       
   204         TInt error = aItem.GetNextInt(course_acc);
       
   205         TReal32 course_acc1 = static_cast<TReal32>(course_acc);
       
   206         if(!error)
       
   207             {
       
   208                 course_obj.SetCourseAccuracy(course_acc1);
       
   209                 if(course_obj.CourseAccuracy()==course_acc1)
       
   210                     {
       
   211                         return KErrNone;
       
   212                         
       
   213                     }
       
   214                 else
       
   215                     return KErrGeneral;
       
   216                 
       
   217             }
       
   218          else
       
   219             return KErrGeneral;
       
   220     }