mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 19:24:25 +03:00
ng_calc_components: rework to move graphs
Rather than cloning graphs for output, rework calc components so that it moves them.
This commit is contained in:
committed by
Matthew Barr
parent
5dfae12a62
commit
ba867ebaff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -33,13 +33,8 @@
|
||||
#include "config.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "nfagraph_common.h"
|
||||
#include "grey.h"
|
||||
#include "hs.h"
|
||||
#include "compiler/compiler.h"
|
||||
#include "nfagraph/ng.h"
|
||||
#include "nfagraph/ng_builder.h"
|
||||
#include "nfagraph/ng_calc_components.h"
|
||||
#include "util/target_info.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ue2;
|
||||
@@ -48,7 +43,7 @@ TEST(NFAGraph, CalcComp1) {
|
||||
auto graph = constructGraph("abc|def|ghi", 0);
|
||||
ASSERT_TRUE(graph != nullptr);
|
||||
|
||||
deque<unique_ptr<NGHolder>> comps = calcComponents(*graph);
|
||||
auto comps = calcComponents(std::move(graph));
|
||||
ASSERT_EQ(3, comps.size());
|
||||
}
|
||||
|
||||
@@ -56,7 +51,7 @@ TEST(NFAGraph, CalcComp2) {
|
||||
auto graph = constructGraph("a|b|c|d|e|f|g|h|i", 0);
|
||||
ASSERT_TRUE(graph != nullptr);
|
||||
|
||||
deque<unique_ptr<NGHolder>> comps = calcComponents(*graph);
|
||||
auto comps = calcComponents(std::move(graph));
|
||||
|
||||
// We should be identifying this as a trivial case and not splitting it.
|
||||
ASSERT_EQ(1, comps.size());
|
||||
|
Reference in New Issue
Block a user