glib/tests/majorversion-test.c
author hgs
Thu, 05 Aug 2010 23:23:13 +0530
changeset 50 79045913e4e9
child 72 403e7f6ed6c5
permissions -rw-r--r--
201031
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50
hgs
parents:
diff changeset
     1
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     2
// All rights reserved.
hgs
parents:
diff changeset
     3
// This component and the accompanying materials are made available
hgs
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     5
// which accompanies this distribution, and is available
hgs
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     7
//
hgs
parents:
diff changeset
     8
// Initial Contributors:
hgs
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    10
//
hgs
parents:
diff changeset
    11
// Contributors:
hgs
parents:
diff changeset
    12
//
hgs
parents:
diff changeset
    13
// Description:
hgs
parents:
diff changeset
    14
//
hgs
parents:
diff changeset
    15
hgs
parents:
diff changeset
    16
hgs
parents:
diff changeset
    17
#undef G_DISABLE_ASSERT
hgs
parents:
diff changeset
    18
#undef G_LOG_DOMAIN
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
#include<stdio.h>
hgs
parents:
diff changeset
    21
#include "glib.h"
hgs
parents:
diff changeset
    22
#define LOG_FILE "c:\\logs\\majorversion_test_log.txt"
hgs
parents:
diff changeset
    23
#include "std_log_result.h"
hgs
parents:
diff changeset
    24
#define LOG_FILENAME_LINE __FILE__, __LINE__
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
void create_xml(int result)
hgs
parents:
diff changeset
    27
{
hgs
parents:
diff changeset
    28
    if(result)
hgs
parents:
diff changeset
    29
        assert_failed = 1;
hgs
parents:
diff changeset
    30
    
hgs
parents:
diff changeset
    31
    testResultXml("version-test");
hgs
parents:
diff changeset
    32
    close_log_file();
hgs
parents:
diff changeset
    33
}
hgs
parents:
diff changeset
    34
hgs
parents:
diff changeset
    35
hgs
parents:
diff changeset
    36
int
hgs
parents:
diff changeset
    37
main (int   argc,
hgs
parents:
diff changeset
    38
      char *argv[])
hgs
parents:
diff changeset
    39
    {
hgs
parents:
diff changeset
    40
    const guint *major_version = NULL;
hgs
parents:
diff changeset
    41
    const guint *minor_version = NULL;
hgs
parents:
diff changeset
    42
    const guint *micro_version = NULL;
hgs
parents:
diff changeset
    43
    const guint *interface_age = NULL;
hgs
parents:
diff changeset
    44
    const guint *binary_age = NULL;
hgs
parents:
diff changeset
    45
    const gchar *check_version = NULL;
hgs
parents:
diff changeset
    46
    major_version = _glib_major_version();
hgs
parents:
diff changeset
    47
    minor_version = _glib_minor_version(); 
hgs
parents:
diff changeset
    48
    micro_version = _glib_micro_version();
hgs
parents:
diff changeset
    49
    interface_age = _glib_interface_age();
hgs
parents:
diff changeset
    50
    binary_age    = _glib_binary_age();  
hgs
parents:
diff changeset
    51
    std_log(LOG_FILENAME_LINE,"Binary age :%d\n Interface age:%d",*binary_age,*interface_age);
hgs
parents:
diff changeset
    52
    check_version = glib_check_version((*major_version),(*minor_version),(*micro_version));
hgs
parents:
diff changeset
    53
    if(check_version != NULL)
hgs
parents:
diff changeset
    54
        {
hgs
parents:
diff changeset
    55
        std_log(LOG_FILENAME_LINE,"GLib library in use is not compatible with the given verison");
hgs
parents:
diff changeset
    56
        assert_failed = 1;
hgs
parents:
diff changeset
    57
        }
hgs
parents:
diff changeset
    58
    if(assert_failed)
hgs
parents:
diff changeset
    59
        {
hgs
parents:
diff changeset
    60
        std_log(LOG_FILENAME_LINE,"%s",check_version);
hgs
parents:
diff changeset
    61
        std_log(LOG_FILENAME_LINE,"Test Fail");
hgs
parents:
diff changeset
    62
        }
hgs
parents:
diff changeset
    63
    else
hgs
parents:
diff changeset
    64
        std_log(LOG_FILENAME_LINE,"Test Successful");    
hgs
parents:
diff changeset
    65
          
hgs
parents:
diff changeset
    66
    
hgs
parents:
diff changeset
    67
    create_xml(assert_failed);
hgs
parents:
diff changeset
    68
    return 0;
hgs
parents:
diff changeset
    69
    }
hgs
parents:
diff changeset
    70
    
hgs
parents:
diff changeset
    71