tstIprtList.cpp revision 222ed601b92c350df3a504c8f4e4228b58ab5b93
039cd2c4871a00e51af909222a34695d9cec3000vboxsync * IPRT Testcase - RTCList/RTCMTList.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Copyright (C) 2011 Oracle Corporation
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * available from http://www.virtualbox.org. This file is free software;
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * 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.
039cd2c4871a00e51af909222a34695d9cec3000vboxsync * The contents of this file may alternatively be used under the terms
039cd2c4871a00e51af909222a34695d9cec3000vboxsync * of the Common Development and Distribution License Version 1.0
039cd2c4871a00e51af909222a34695d9cec3000vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
039cd2c4871a00e51af909222a34695d9cec3000vboxsync * VirtualBox OSE distribution, in which case the provisions of the
039cd2c4871a00e51af909222a34695d9cec3000vboxsync * CDDL are applicable instead of those of the GPL.
039cd2c4871a00e51af909222a34695d9cec3000vboxsync * You may elect to license modified versions of this file under the
039cd2c4871a00e51af909222a34695d9cec3000vboxsync * terms and conditions of either the GPL or the CDDL or both.
7203f6c17d0f467b2735c4cf235948225e73c2cevboxsync/*******************************************************************************
19edb133387698f301b529248daa3719fe0d7389vboxsync* Header Files *
19edb133387698f301b529248daa3719fe0d7389vboxsync*******************************************************************************/
7203f6c17d0f467b2735c4cf235948225e73c2cevboxsync/*******************************************************************************
039cd2c4871a00e51af909222a34695d9cec3000vboxsync* Global Variables *
039cd2c4871a00e51af909222a34695d9cec3000vboxsync*******************************************************************************/
19edb133387698f301b529248daa3719fe0d7389vboxsync/** Used for the string test. */
19edb133387698f301b529248daa3719fe0d7389vboxsyncstatic const char *g_apszTestStrings[] =
19edb133387698f301b529248daa3719fe0d7389vboxsync "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
19edb133387698f301b529248daa3719fe0d7389vboxsync "Vestibulum non turpis vel metus pellentesque tincidunt at id massa.",
19edb133387698f301b529248daa3719fe0d7389vboxsync "Cras quis erat sed nulla ullamcorper molestie.",
19edb133387698f301b529248daa3719fe0d7389vboxsync "Mauris ac elit turpis, id pulvinar diam.",
19edb133387698f301b529248daa3719fe0d7389vboxsync "Nulla quis dolor dolor, in ultrices diam.",
19edb133387698f301b529248daa3719fe0d7389vboxsync "Vivamus ac quam non ipsum vehicula tempor ac ac arcu.",
19edb133387698f301b529248daa3719fe0d7389vboxsync "Aenean posuere lacus blandit erat semper eu iaculis ante eleifend.",
039cd2c4871a00e51af909222a34695d9cec3000vboxsync "Donec quis quam a lacus interdum sollicitudin quis eu est.",
039cd2c4871a00e51af909222a34695d9cec3000vboxsync "Morbi sed nisi a arcu commodo convallis.",
19edb133387698f301b529248daa3719fe0d7389vboxsync "Aenean molestie condimentum velit, non mattis magna ultricies quis.",
19edb133387698f301b529248daa3719fe0d7389vboxsync "Nulla id velit at mauris gravida mattis.",
19edb133387698f301b529248daa3719fe0d7389vboxsync "Phasellus viverra velit eu urna semper in porta arcu sollicitudin.",
19edb133387698f301b529248daa3719fe0d7389vboxsync "Pellentesque consequat turpis et tortor hendrerit id tempor ipsum lacinia.",
19edb133387698f301b529248daa3719fe0d7389vboxsync "Cras iaculis nulla quis risus pulvinar eget tempor lectus placerat.",
return VINF_SUCCESS;
return VINF_SUCCESS;
return VINF_SUCCESS;
MTTESTTYPE a;
return VINF_SUCCESS;
return VINF_SUCCESS;
return VINF_SUCCESS;
static void test2()
rc = RTThreadCreate(&hThread1, &mttest1, &testList, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "mttest1");
rc = RTThreadCreate(&hThread2, &mttest2, &testList, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "mttest2");
rc = RTThreadCreate(&hThread3, &mttest3, &testList, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "mttest3");
rc = RTThreadCreate(&hThread4, &mttest4, &testList, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "mttest4");
rc = RTThreadCreate(&hThread5, &mttest5, &testList, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "mttest5");
rc = RTThreadCreate(&hThread6, &mttest6, &testList, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "mttest6");
int main()
if (rcExit)
return rcExit;
test1<RTCList, uint8_t, uint8_t, uint8_t>("ST: Native type", au8TestInts, RT_ELEMENTS(au8TestInts));
test1<RTCMTList, uint8_t, uint8_t, uint8_t>("MT: Native type", au8TestInts, RT_ELEMENTS(au8TestInts));
test1<RTCList, uint16_t, uint16_t, uint16_t>("ST: Native type", au16TestInts, RT_ELEMENTS(au16TestInts));
test1<RTCMTList, uint16_t, uint16_t, uint16_t>("MT: Native type", au16TestInts, RT_ELEMENTS(au16TestInts));
test1<RTCList, uint32_t, uint32_t, uint32_t>("ST: Native type", au32TestInts, RT_ELEMENTS(au32TestInts));
test1<RTCMTList, uint32_t, uint32_t, uint32_t>("MT: Native type", au32TestInts, RT_ELEMENTS(au32TestInts));
test1<RTCList, uint64_t, uint64_t, uint64_t>("ST: Specialized type", au64TestInts, RT_ELEMENTS(au64TestInts));
test1<RTCMTList, uint64_t, uint64_t, uint64_t>("MT: Specialized type", au64TestInts, RT_ELEMENTS(au64TestInts));
test1<RTCList, RTCString, RTCString *, const char *>("ST: Class type", g_apszTestStrings, RT_ELEMENTS(g_apszTestStrings));
test1<RTCMTList, RTCString, RTCString *, const char *>("MT: Class type", g_apszTestStrings, RT_ELEMENTS(g_apszTestStrings));
test2();