fix unit tests to build on osx / clang16
This commit is contained in:
parent
c3a6684c4f
commit
210a3c5f64
3 changed files with 12 additions and 8 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "xo/alloc/generation.hpp"
|
#include "xo/alloc/generation.hpp"
|
||||||
|
#include <sstream>
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include "xo/reflect/reflect_struct.hpp"
|
#include "xo/reflect/reflect_struct.hpp"
|
||||||
#include "xo/indentlog/scope.hpp"
|
#include "xo/indentlog/scope.hpp"
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
using xo::jit::MachPipeline;
|
using xo::jit::MachPipeline;
|
||||||
|
|
@ -24,19 +25,20 @@ namespace xo {
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
namespace ut {
|
namespace ut {
|
||||||
|
double (*sqrt_double)(double) = &std::sqrt;
|
||||||
|
|
||||||
/* abstract syntax tree for a function:
|
/* abstract syntax tree for a function:
|
||||||
* def root4(x :: double) { sqrt(sqrt(x)); }
|
* def root4(x :: double) { sqrt(sqrt(x)); }
|
||||||
*/
|
*/
|
||||||
rp<Expression>
|
rp<Expression>
|
||||||
root4_ast() {
|
root4_ast() {
|
||||||
auto sqrt = make_primitive("sqrt",
|
auto sqrtx = make_primitive("sqrt",
|
||||||
::sqrt,
|
sqrt_double,
|
||||||
false /*!explicit_symbol_def*/,
|
false /*!explicit_symbol_def*/,
|
||||||
llvmintrinsic::fp_sqrt);
|
llvmintrinsic::fp_sqrt);
|
||||||
auto x_var = make_var("x", Reflect::require<double>());
|
auto x_var = make_var("x", Reflect::require<double>());
|
||||||
auto call1 = make_apply(sqrt, {x_var});
|
auto call1 = make_apply(sqrtx, {x_var});
|
||||||
auto call2 = make_apply(sqrt, {call1});
|
auto call2 = make_apply(sqrtx, {call1});
|
||||||
|
|
||||||
auto fn_ast = make_lambda("root4",
|
auto fn_ast = make_lambda("root4",
|
||||||
{x_var},
|
{x_var},
|
||||||
|
|
@ -52,7 +54,7 @@ namespace xo {
|
||||||
rp<Expression>
|
rp<Expression>
|
||||||
root_2x_ast() {
|
root_2x_ast() {
|
||||||
auto root = make_primitive("sqrt",
|
auto root = make_primitive("sqrt",
|
||||||
::sqrt,
|
sqrt_double,
|
||||||
false /*!explicit_symbol_def*/,
|
false /*!explicit_symbol_def*/,
|
||||||
llvmintrinsic::fp_sqrt);
|
llvmintrinsic::fp_sqrt);
|
||||||
|
|
||||||
|
|
@ -202,7 +204,7 @@ namespace xo {
|
||||||
auto jit = MachPipeline::make();
|
auto jit = MachPipeline::make();
|
||||||
|
|
||||||
auto root = make_primitive("sqrt",
|
auto root = make_primitive("sqrt",
|
||||||
::sqrt,
|
sqrt_double,
|
||||||
false /*!explicit_symbol_def*/,
|
false /*!explicit_symbol_def*/,
|
||||||
llvmintrinsic::fp_sqrt);
|
llvmintrinsic::fp_sqrt);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
namespace reflect {
|
namespace reflect {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue