1 /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3 * Copyright 2017 Couchbase, Inc
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 #include "item.h"
19 #include "systemevent.h"
20
21 #include <gtest/gtest.h>
22
TEST(SystemEventTest, make)23 TEST(SystemEventTest, make) {
24 auto value = SystemEventFactory::make(SystemEvent::Collection,
25 "SUFFIX",
26 0,
27 OptionalSeqno(/*none*/));
28 EXPECT_EQ(queue_op::system_event, value->getOperation());
29 EXPECT_EQ(0, value->getNBytes());
30 EXPECT_NE(nullptr, strstr(value->getKey().c_str(), "SUFFIX"));
31 EXPECT_EQ(uint32_t(SystemEvent::Collection), value->getFlags());
32 EXPECT_EQ(-1, value->getBySeqno());
33
34 value = SystemEventFactory::make(SystemEvent::Collection,
35 "SUFFIX",
36 100,
37 OptionalSeqno(/*none*/));
38 EXPECT_EQ(queue_op::system_event, value->getOperation());
39 EXPECT_EQ(100, value->getNBytes());
40 EXPECT_NE(nullptr, strstr(value->getKey().c_str(), "SUFFIX"));
41 EXPECT_EQ(uint32_t(SystemEvent::Collection), value->getFlags());
42 }
43