tstRTStrVersion.cpp revision c72f00ff9f31a65845a8722126d37708b61bb6ae
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * IPRT Testcase - Version String Comparison.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * Copyright (C) 2009 Sun Microsystems, Inc.
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * available from http://www.virtualbox.org. This file is free software;
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * The contents of this file may alternatively be used under the terms
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * of the Common Development and Distribution License Version 1.0
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * VirtualBox OSE distribution, in which case the provisions of the
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * CDDL are applicable instead of those of the GPL.
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * You may elect to license modified versions of this file under the
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * terms and conditions of either the GPL or the CDDL or both.
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * additional information or have any questions.
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync/*******************************************************************************
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync* Header Files *
611910c4ba57eb6db5c0d508ca7b923efd654aecvboxsync*******************************************************************************/
611910c4ba57eb6db5c0d508ca7b923efd654aecvboxsync int rc = RTTestInitAndCreate("tstRTStrVersion", &hTest);
289060a0c3cb1d509f2cb01fca060796212376f6vboxsync static struct
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync const char *pszVer1;
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync const char *pszVer2;
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync { "VirtualBox-2.0.8-Beta2", "VirtualBox-2.0.8_Beta3-r12345", -1 },
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync { "VirtualBox-2.2.4-Beta2", "VirtualBox-2.2.2", 1 },
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync { "VirtualBox-2.2.4-Beta3", "VirtualBox-2.2.2-Beta4", 1 },
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync { "VirtualBox-3.1.8-Alpha1", "VirtualBox-3.1.8-Alpha1-r61454", -1 },
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync { "VirtualBox-3.1.0", "VirtualBox-3.1.2_Beta1", -1 },
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync for (unsigned iTest = 0; iTest < RT_ELEMENTS(aTests); iTest++)
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync int iResult = RTStrVersionCompare(aTests[iTest].pszVer1, aTests[iTest].pszVer2);
ff78b877ed7acd25e2d384570a938441455d6a95vboxsync RTTestFailed(hTest, "#%u: '%s' <-> '%s' -> %d, expected %d",