forked from arrayfire/arrayfire
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent.cpp
More file actions
53 lines (43 loc) · 1.34 KB
/
event.cpp
File metadata and controls
53 lines (43 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*******************************************************
* Copyright (c) 2019, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include <arrayfire.h>
#include <gtest/gtest.h>
#include <testHelpers.hpp>
#include <af/event.h>
#include <memory>
#include <utility>
#include <iostream>
using af::event;
TEST(EventTests, SimpleCreateRelease) {
af_event event;
ASSERT_SUCCESS(af_create_event(&event));
ASSERT_SUCCESS(af_delete_event(event));
}
TEST(EventTests, MarkEnqueueAndBlock) {
af_event event;
ASSERT_SUCCESS(af_create_event(&event));
ASSERT_SUCCESS(af_mark_event(event));
ASSERT_SUCCESS(af_enqueue_wait_event(event));
ASSERT_SUCCESS(af_block_event(event));
ASSERT_SUCCESS(af_delete_event(event));
}
TEST(EventTests, EventCreateAndMove) {
af_event eventHandle;
ASSERT_SUCCESS(af_create_event(&eventHandle));
event e(eventHandle);
e.mark();
ASSERT_EQ(eventHandle, e.get());
auto otherEvent = std::move(e);
ASSERT_EQ(otherEvent.get(), eventHandle);
event f;
af_event fE = f.get();
event anotherEvent = std::move(f);
ASSERT_EQ(fE, anotherEvent.get());
af::sync();
}