OTest2
A C++ testing framework
difflogarray.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Ondrej Starek
3  *
4  * This file is part of OTest2.
5  *
6  * OTest2 is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License,
9  * or (at your option) any later version.
10  *
11  * OTest2 is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with OTest2. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #include <difflogarray.h>
20 
21 #include <assert.h>
22 
23 namespace OTest2 {
24 
26  DiffLogArray* array_) :
27  array(array_) {
28  assert(array != nullptr);
29 
30 }
31 
33 
34 }
35 
37  int left_index_,
38  int right_index_) {
39  /* -- nothing to do */
40 }
41 
43  int left_index_,
44  int right_index_) {
45  array->push_back({DiffAction::CHANGE, left_index_, right_index_});
46 }
47 
49  int right_index_) {
50  array->push_back({DiffAction::DELETE, -1, right_index_});
51 }
52 
54  int left_index_) {
55  array->push_back({DiffAction::INSERT, left_index_, -1});
56 }
57 
58 } /* namespace OTest2 */
difflogarray.h
OTest2::DiffLogBuilderArray::addDelete
virtual void addDelete(int right_index_)
Add deleted item from the right sequence.
Definition: difflogarray.cpp:48
OTest2::DiffAction::CHANGE
@ CHANGE
OTest2
Definition: assertbean.h:25
OTest2::DiffLogBuilderArray::addInsert
virtual void addInsert(int left_index_)
Add inserted item to the left sequence.
Definition: difflogarray.cpp:53
OTest2::DiffAction::INSERT
@ INSERT
OTest2::DiffLogBuilderArray::addChange
virtual void addChange(int left_index_, int right_index_)
Add change of both sequences.
Definition: difflogarray.cpp:42
OTest2::DiffLogArray
std::vector< DiffRecord > DiffLogArray
Ordered (indexes into the sequences) list of diff changes.
Definition: difflogarray.h:47
OTest2::DiffLogBuilderArray::addMatch
virtual void addMatch(int left_index_, int right_index_)
Add match of characters in both sequences.
Definition: difflogarray.cpp:36
OTest2::DiffLogBuilderArray::DiffLogBuilderArray
DiffLogBuilderArray(DiffLogArray *array_)
Ctor.
Definition: difflogarray.cpp:25
OTest2::DiffAction::DELETE
@ DELETE
OTest2::DiffLogBuilderArray::~DiffLogBuilderArray
virtual ~DiffLogBuilderArray()
Dtor.
Definition: difflogarray.cpp:32