Refactors sequential misc test cases
[libcds.git] / test / stress / sequential / test.cpp
1 /*
2     This file is a part of libcds - Concurrent Data Structures library
3
4     (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
5
6     Source code repo: http://github.com/khizmax/libcds/
7     Download: http://sourceforge.net/projects/libcds/files/
8
9     Redistribution and use in source and binary forms, with or without
10     modification, are permitted provided that the following conditions are met:
11
12     * Redistributions of source code must retain the above copyright notice,
13    this
14     list of conditions and the following disclaimer.
15
16     * Redistributions in binary form must reproduce the above copyright notice,
17     this list of conditions and the following disclaimer in the documentation
18     and/or other materials provided with the distribution.
19
20     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23    ARE
24     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29    LIABILITY,
30     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
31    USE
32     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 #include "../misc/common.h"
36 #include "../stack/stack_type.h"
37 #include <cds/sync/spinlock.h>
38 #include <cds/misc/RigtorpSPSCQueue.h>
39
40 namespace {
41
42 class sequential_test : public cds_test::stress_fixture {
43
44 };
45
46 atomics::atomic<int> x;
47 atomics::atomic<int> y;
48 typedef cds::sync::spin SpinLock;
49 SpinLock l;
50
51 struct value_type {
52   size_t num;
53 };
54
55 typedef stack::Types<value_type>::Treiber_HP stack_type;
56 stack_type stack;
57 rigtorp::SPSCQueue<size_t> q(10);
58
59 TEST_F(sequential_test, TEST) {
60 //  l.lock();
61 //  l.unlock();
62 //  y.store(1, atomics::memory_order_relaxed);
63 //  value_type v = {1};
64 //  stack.push(v);
65 //  stack.pop(v);
66
67   q.push(1);
68 }
69
70 } // namespace