Added thread test.

This commit is contained in:
Branimir Karadžić
2014-08-03 09:33:11 -07:00
parent ec2d1f8e93
commit d8ef558932
4 changed files with 52 additions and 1 deletions

38
tests/thread.cpp Normal file
View File

@@ -0,0 +1,38 @@
/*
* Copyright 2010-2013 Branimir Karadzic. All rights reserved.
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "test.h"
#include <bx/thread.h>
int32_t threadExit0(void*)
{
return 0;
}
int32_t threadExit1(void*)
{
return 1;
}
TEST(thread)
{
bx::Thread th;
CHECK_EQUAL(th.isRunning(), false);
th.init(threadExit0);
CHECK_EQUAL(th.isRunning(), true);
th.shutdown();
CHECK_EQUAL(th.isRunning(), false);
CHECK_EQUAL(th.getExitCode(), 0);
th.init(threadExit1);
CHECK_EQUAL(th.isRunning(), true);
th.shutdown();
CHECK_EQUAL(th.isRunning(), false);
CHECK_EQUAL(th.getExitCode(), 1);
}