C++Spec 1.0.0
BDD testing for C++
Loading...
Searching...
No Matches
start_with.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include <ranges>
5#include <string>
6
8
9namespace CppSpec::Matchers {
10
11template <std::ranges::range A, std::ranges::range E>
12class StartWith : public MatcherBase<A, E> {
13 public:
14 StartWith(Expectation<A>& expectation, E start) : MatcherBase<A, E>(expectation, start) {}
15
16 std::string verb() override { return "start with"; }
17
18 bool match() override {
19 A& actual = this->actual();
20 E& expected = this->expected();
21 return std::equal(expected.begin(), expected.end(), actual.begin());
22 }
23};
24
25} // namespace CppSpec::Matchers
Wraps the target of an expectation.
Definition expectation.hpp:47
Definition have_error.hpp:9
Contains the base class for all Matchers.