Adding clang-format configuration file and formatting all source files
Co-authored-by: Jules Pénuchot <jules@penuchot.com> Co-authored-by: Joel FALCOU <jfalcou@codereckons.com> See merge request oss/rotgen!41
This commit is contained in:
parent
e92e824a18
commit
648dd768ee
94 changed files with 6778 additions and 4722 deletions
|
|
@ -9,76 +9,81 @@
|
|||
#include <rotgen/rotgen.hpp>
|
||||
#include <sstream>
|
||||
|
||||
TTS_CASE_TPL("I/O for matrix", rotgen::tests::types)
|
||||
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
||||
TTS_CASE_TPL("I/O for matrix", rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
{
|
||||
rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value> x({ {1,2} , {3,4} });
|
||||
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value> x(
|
||||
{{1, 2}, {3, 4}});
|
||||
std::ostringstream os;
|
||||
os << x;
|
||||
|
||||
TTS_EQUAL(os.str(), std::string{"1 2\n3 4"});
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("I/O for block", rotgen::tests::types)
|
||||
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
||||
TTS_CASE_TPL("I/O for block", rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
{
|
||||
rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value> base({ {1,2} , {3,4} });
|
||||
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value> base(
|
||||
{{1, 2}, {3, 4}});
|
||||
|
||||
auto x = rotgen::extract(base,0,0,2,2);
|
||||
auto x = rotgen::extract(base, 0, 0, 2, 2);
|
||||
std::ostringstream os;
|
||||
os << x;
|
||||
|
||||
TTS_EQUAL(os.str(), std::string{"1 2\n3 4"});
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("I/O for map test", rotgen::tests::types)
|
||||
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
||||
TTS_CASE_TPL("I/O for map test", rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
{
|
||||
using base = rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value>;
|
||||
using base = rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value>;
|
||||
|
||||
T data[] = {1,2,3,4};
|
||||
T data[] = {1, 2, 3, 4};
|
||||
|
||||
rotgen::map<base> x(data,2,2);
|
||||
rotgen::map<base> x(data, 2, 2);
|
||||
std::ostringstream os;
|
||||
os << x;
|
||||
|
||||
if constexpr(O::value) TTS_EQUAL(os.str(), std::string{"1 2\n3 4"});
|
||||
else TTS_EQUAL(os.str(), std::string{"1 3\n2 4"});
|
||||
if constexpr (O::value) TTS_EQUAL(os.str(), std::string{"1 2\n3 4"});
|
||||
else TTS_EQUAL(os.str(), std::string{"1 3\n2 4"});
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("I/O using format", rotgen::tests::types)
|
||||
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
||||
TTS_CASE_TPL("I/O using format", rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
{
|
||||
rotgen::ioformat io(rotgen::StreamPrecision, 0, ", ", ";\n", "<", ">", "[", "]");
|
||||
rotgen::ioformat io(rotgen::StreamPrecision, 0, ", ", ";\n", "<", ">", "[",
|
||||
"]");
|
||||
|
||||
rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value> x({ {1,2} , {3,4} });
|
||||
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value> x(
|
||||
{{1, 2}, {3, 4}});
|
||||
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << rotgen::format(x,io);
|
||||
os << rotgen::format(x, io);
|
||||
TTS_EQUAL(os.str(), std::string{"[<1, 2>;\n <3, 4>]"});
|
||||
}
|
||||
|
||||
rotgen::map<rotgen::matrix<T,2,2,O::value>> m{x.data()};
|
||||
rotgen::map<rotgen::matrix<T, 2, 2, O::value>> m{x.data()};
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << rotgen::format(m,io);
|
||||
os << rotgen::format(m, io);
|
||||
TTS_EQUAL(os.str(), std::string{"[<1, 2>;\n <3, 4>]"});
|
||||
}
|
||||
|
||||
auto b = rotgen::extract(x,0,0,2,2);
|
||||
auto b = rotgen::extract(x, 0, 0, 2, 2);
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << rotgen::format(b,io);
|
||||
os << rotgen::format(b, io);
|
||||
TTS_EQUAL(os.str(), std::string{"[<1, 2>;\n <3, 4>]"});
|
||||
}
|
||||
|
||||
auto printer = [&](rotgen::ref<const rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value>> r)
|
||||
{
|
||||
std::ostringstream st;
|
||||
st << rotgen::format(r,io);
|
||||
return st.str();
|
||||
};
|
||||
auto printer =
|
||||
[&](rotgen::ref<rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic,
|
||||
O::value> const> r) {
|
||||
std::ostringstream st;
|
||||
st << rotgen::format(r, io);
|
||||
return st.str();
|
||||
};
|
||||
|
||||
TTS_EQUAL(printer(x), std::string{"[<1, 2>;\n <3, 4>]"});
|
||||
TTS_EQUAL(printer(m), std::string{"[<1, 2>;\n <3, 4>]"});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue