Skip to content

Commit

Permalink
Fixed #35 - unified namespaces and directory names
Browse files Browse the repository at this point in the history
  • Loading branch information
bartop committed Jan 2, 2018
1 parent 24da6ff commit f4ef142
Show file tree
Hide file tree
Showing 38 changed files with 70 additions and 49 deletions.
2 changes: 1 addition & 1 deletion tests/all_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <vector>

using namespace std;
using namespace tpl;
using namespace tpl::sink;

TEST_CASE( "All in vector", "[all_test]" ) {
const auto v = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
Expand Down
2 changes: 1 addition & 1 deletion tests/any_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <vector>

using namespace std;
using namespace tpl;
using namespace tpl::sink;

TEST_CASE( "Any in vector", "[any_test]" ) {
vector<int> v{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
Expand Down
2 changes: 1 addition & 1 deletion tests/copy_to_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <vector>

using namespace std;
using namespace tpl;
using namespace tpl::sink;

TEST_CASE( "Copying into a vector", "[copy_to_test]" ) {
SECTION("Test 1"){
Expand Down
2 changes: 1 addition & 1 deletion tests/count_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <vector>

using namespace std;
using namespace tpl;
using namespace tpl::sink;

TEST_CASE( "Count in initializer list", "[count_test]" ) {
const auto v = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
Expand Down
6 changes: 3 additions & 3 deletions tests/enumerable_traits_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <catch.hpp>

#include <meta/enumerable_traits.hpp>
#include <operator/filtered.hpp>
#include <operator/transformed.hpp>
#include <operation/filtered.hpp>
#include <operation/transformed.hpp>

#include <vector>
#include <map>
Expand All @@ -13,7 +13,7 @@
#include <functional>

using namespace tpl::meta;
using namespace tpl;
using namespace tpl::operation;


TEST_CASE( "Check created type traits", "[enumerable_traits_test]" ) {
Expand Down
14 changes: 7 additions & 7 deletions tests/filtered_test.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include <catch.hpp>

#include <operator/filtered.hpp>
#include <operation/filtered.hpp>

#include <vector>

TEST_CASE( "Vector filtering", "[filtered_test]" ) {
using namespace std;
using namespace tpl;
using namespace tpl::operation;
vector<int> v{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
SECTION(" >= 1"){
const auto vf = (v | filter([](const auto &i){ return i >= 1; }));
Expand All @@ -28,7 +28,7 @@ TEST_CASE( "Vector filtering", "[filtered_test]" ) {

TEST_CASE( "C array filtering", "[filtered_test]" ) {
using namespace std;
using namespace tpl;
using namespace tpl::operation;
int v[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
SECTION(" >= 1"){
const auto vf = (v | filter([](const auto &i){ return i >= 1; }));
Expand All @@ -51,18 +51,18 @@ TEST_CASE( "Vector filtering without using namespace tpl", "[filtered_test]" ) {
using namespace std;
vector<int> v{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
SECTION(" >= 1"){
const auto vf = (v | tpl::filter([](const auto &i){ return i >= 1; }));
const auto vf = v | tpl::operation::filter([](const auto &i){ return i >= 1; });
vector<int> result(vf.begin(), vf.end());
REQUIRE(v == result);
}
SECTION(" > 10"){
const auto vf = (v | tpl::filter([](const auto &i){ return i > 10; }));
const auto vf = v | tpl::operation::filter([](const auto &i){ return i > 10; });
vector<int> result(vf.begin(), vf.end());
REQUIRE(vector<int>() == result);
}
SECTION(" > 5"){
const auto vf = (v | tpl::filter([](const auto &i){ return i > 5; }));
const auto vf = v | tpl::operation::filter([](const auto &i){ return i > 5; });
vector<int> result(vf.begin(), vf.end());
REQUIRE((std::vector<int>{ 6, 7, 8, 9, 10 }) == result);
REQUIRE((vector<int>{ 6, 7, 8, 9, 10 }) == result);
}
}
4 changes: 2 additions & 2 deletions tests/flattened_test.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include <catch.hpp>

#include <operator/flattened.hpp>
#include <operation/flattened.hpp>

#include <vector>

using namespace std;
using namespace tpl;
using namespace tpl::operation;

TEST_CASE( "Vector of vectors flattening", "[flattened_test]" ) {
vector<vector<int>> v;
Expand Down
2 changes: 1 addition & 1 deletion tests/fold_left_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <vector>

using namespace std;
using namespace tpl;
using namespace tpl::sink;

TEST_CASE( "Fold left initializer list", "[fold_left_test]" ) {
const auto v = { 1, 2, 3, 4, 5 };
Expand Down
2 changes: 1 addition & 1 deletion tests/generator_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

using namespace std::string_literals;
using namespace std;
using namespace tpl;
using namespace tpl::generator;

TEST_CASE( "Testing generated sequence", "[generator_test]" ) {
SECTION("1") {
Expand Down
2 changes: 1 addition & 1 deletion tests/infinite_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <vector>

using namespace std;
using namespace tpl;
using namespace tpl::generator;

TEST_CASE( "Testing infinite sequence", "[infinite_test]" ) {
SECTION("1") {
Expand Down
6 changes: 3 additions & 3 deletions tests/is_associative_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <catch.hpp>

#include <meta/is_associative.hpp>
#include <operator/filtered.hpp>
#include <operator/transformed.hpp>
#include <operation/filtered.hpp>
#include <operation/transformed.hpp>

#include <vector>
#include <map>
Expand All @@ -13,7 +13,7 @@
#include <functional>

using namespace tpl::meta;
using namespace tpl;
using namespace tpl::operation;

TEST_CASE( "Check created type traits", "[is_associative_test]" ) {
REQUIRE(is_associative<char(&)[4]>::value == false);
Expand Down
4 changes: 2 additions & 2 deletions tests/keys_test.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include <catch.hpp>

#include <operator/keys.hpp>
#include <operation/keys.hpp>

#include <vector>

using namespace std;
using namespace tpl;
using namespace tpl::operation;

TEST_CASE( "Keys", "[keys_test]" ) {
SECTION("Test 1"){
Expand Down
4 changes: 2 additions & 2 deletions tests/mapped_values_test.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include <catch.hpp>

#include <operator/mapped_values.hpp>
#include <operation/mapped_values.hpp>

#include <vector>

using namespace std;
using namespace tpl;
using namespace tpl::operation;

TEST_CASE( "Keys", "[keys_test]" ) {
SECTION("Test 1"){
Expand Down
4 changes: 2 additions & 2 deletions tests/sorted_test.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include <catch.hpp>

#include <operator/sorted.hpp>
#include <operation/sorted.hpp>

#include <vector>

using namespace std;
using namespace tpl;
using namespace tpl::operation;

TEST_CASE( "Vector sorting", "[transformed_test]" ) {
vector<int> v{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
Expand Down
6 changes: 3 additions & 3 deletions tests/transformed_test.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include <catch.hpp>

#include <operator/transformed.hpp>
#include <operation/transformed.hpp>

#include <vector>

using namespace std;
using namespace tpl;
using namespace tpl::operation;

TEST_CASE( "Vector transforming", "[transformed_test]" ) {
vector<int> v{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
Expand All @@ -22,7 +22,7 @@ TEST_CASE( "Vector transforming", "[transformed_test]" ) {
REQUIRE((vector<int>{ 2, 4, 6, 8, 10, 12, 14, 16, 18, 20})== result);
}

SECTION(" std::vector<int>(i) "){
SECTION("std::vector<int>(i)"){
const auto vf = (vector<int>{ 1, 2 } | transform([](const auto &i){ return vector<int>{i}; }));
vector<vector<int>> result(vf.begin(), vf.end());
REQUIRE((vector<vector<int>>{ vector<int>{1}, vector<int>{2} }) == result);
Expand Down
4 changes: 2 additions & 2 deletions tests/zipped_test.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include <catch.hpp>

#include <operator/zipped.hpp>
#include <operation/zipped.hpp>

#include <vector>

TEST_CASE( "Vector zipping", "[zipped_test]" ) {
using namespace std;
using namespace tpl;
using namespace tpl::operation;
vector<int> v1{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
vector<int> v2{ 3, 4, 5, 6, 7, 8, 9, 10 };
vector<int> v3{ 5, 6, 7, 8, 9, 10 };
Expand Down
2 changes: 2 additions & 0 deletions tpl/detail/pointer_proxy.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#include <utility>

namespace tpl{
namespace detail{

template<class T>
Expand All @@ -20,3 +21,4 @@ make_pointer_proxy(T &&value){
}

}
}
2 changes: 2 additions & 0 deletions tpl/generator/generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <algorithm>

namespace tpl{
namespace generator{

template<class GeneratingFunction, class ValueType>
class generating_iterator {
Expand Down Expand Up @@ -119,3 +120,4 @@ generator(GeneratingFunction &&generatingFunction, ValueType &&initialValue){
}

}
}
2 changes: 2 additions & 0 deletions tpl/generator/infinite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <algorithm>

namespace tpl{
namespace generator{

template<class ValueType>
class infinite_iterator {
Expand Down Expand Up @@ -106,3 +107,4 @@ infinite(ValueType &&value){
}

}
}
2 changes: 0 additions & 2 deletions tpl/meta/enumerable_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <type_traits>

namespace tpl{

namespace meta{

template<class T, class = void>
Expand Down Expand Up @@ -46,5 +45,4 @@ struct enumerable_traits<
};

}

}
2 changes: 0 additions & 2 deletions tpl/meta/is_associative.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <utility>

namespace tpl{

namespace meta{

template<class T, class = void>
Expand Down Expand Up @@ -73,5 +72,4 @@ template<class T>
using associative_traits = typename std::conditional<is_associative<T>::value, associative_base<T>, empty_base>::type;

}

}
3 changes: 0 additions & 3 deletions tpl/meta/is_enumerable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
#include <iterator>

namespace tpl {

namespace meta {


template<class T, class = void>
struct can_begin : std::false_type {
};
Expand Down Expand Up @@ -63,5 +61,4 @@ struct enforce_enumerable {
};

}

}
2 changes: 0 additions & 2 deletions tpl/meta/type_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
#pragma once

namespace tpl {

namespace meta {

template<class ...> struct type_sink { typedef void type; };

}

}
2 changes: 2 additions & 0 deletions tpl/operator/filtered.hpp → tpl/operation/filtered.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <algorithm>

namespace tpl{
namespace operation{

template<class FilterPredicate>
struct filter_holder {
Expand Down Expand Up @@ -165,3 +166,4 @@ operator|(
}

}
}
2 changes: 2 additions & 0 deletions tpl/operator/flattened.hpp → tpl/operation/flattened.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <algorithm>

namespace tpl{
namespace operation{

template<class OuterIterator, class InnerIterator>
class flattening_iterator {
Expand Down Expand Up @@ -156,3 +157,4 @@ operator|(Enumerable &&enumerable, const flatten_tag &){
}

}
}
2 changes: 2 additions & 0 deletions tpl/operator/keys.hpp → tpl/operation/keys.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <algorithm>

namespace tpl{
namespace operation{

template<class SubIterator>
class keys_iterator {
Expand Down Expand Up @@ -123,3 +124,4 @@ operator|(Enumerable &&enumerable, const keys_tag &) {
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <algorithm>

namespace tpl{
namespace operation{

template<class SubIterator>
class mapped_values_iterator {
Expand Down Expand Up @@ -123,3 +124,4 @@ operator|(Enumerable &&enumerable, const mapped_values_tag &) {
}

}
}
Loading

0 comments on commit f4ef142

Please sign in to comment.