source: trunk/test/unit/thread.cpp @ 2872

Last change on this file since 2872 was 2872, checked in by lolbot, 6 years ago

fixed 6 files out of 2787:

  • removed 0 CR characters
  • removed 35 trailing whitespaces
  • replaced 0 tabs with spaces
  • fixed 5 svn:eol-style properties
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://www.wtfpl.net/ for more details.
9//
10
11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
15#include "core.h"
16#include "lol/unit.h"
17
18namespace lol
19{
20
21LOLUNIT_FIXTURE(ThreadTest)
22{
23    void SetUp() {}
24
25    void TearDown() {}
26
27    LOLUNIT_TEST(QueueTryPush)
28    {
29        Queue<int, 1> q;
30
31        bool b1 = q.TryPush(0);
32        LOLUNIT_ASSERT_EQUAL(true, b1);
33
34        bool b2 = q.TryPush(1);
35        LOLUNIT_ASSERT_EQUAL(false, b2);
36    }
37
38    LOLUNIT_TEST(QueueTryPop)
39    {
40        Queue<int, 1> q;
41        int tmp;
42
43        q.Push(42);
44
45        bool b1 = q.TryPop(tmp);
46        LOLUNIT_ASSERT_EQUAL(true, b1);
47        LOLUNIT_ASSERT_EQUAL(42, tmp);
48
49        bool b2 = q.TryPop(tmp);
50        LOLUNIT_ASSERT_EQUAL(false, b2);
51        LOLUNIT_ASSERT_EQUAL(42, tmp);
52    }
53};
54
55} /* namespace lol */
56
Note: See TracBrowser for help on using the repository browser.