Commit fb4f6c8e authored by cianciosa's avatar cianciosa
Browse files

Add full test coverage for all C language bindings.

parent 2ce2545a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
add_tool_target (xrays_bench  cpp)

if (${USE_PCH})
if (${USE_PCH} AND NOT ${BUILD_C_BINDING})
    target_precompile_headers (xrays_bench REUSE_FROM xrays)
endif ()
+42 −0
Original line number Diff line number Diff line
@@ -1255,6 +1255,44 @@ extern "C" {
//******************************************************************************
//  Random
//******************************************************************************
//------------------------------------------------------------------------------
///  @brief Get random size.
///
///  @param[in] c The graph C context.
///  @return The random size.
//------------------------------------------------------------------------------
    size_t graph_random_size(STRUCT_TAG graph_c_context *c) {
        switch (c->type) {
            case FLOAT:
                if (c->safe_math) {
                    return jit::context<float, true>::random_state_size;
                } else {
                    return jit::context<float>::random_state_size;
                }

            case DOUBLE:
                if (c->safe_math) {
                    return jit::context<double, true>::random_state_size;
                } else {
                    return jit::context<double>::random_state_size;
                }

            case COMPLEX_FLOAT:
                if (c->safe_math) {
                    return jit::context<std::complex<float>, true>::random_state_size;
                } else {
                    return jit::context<std::complex<float>>::random_state_size;
                }

            case COMPLEX_DOUBLE:
                if (c->safe_math) {
                    return jit::context<std::complex<double>, true>::random_state_size;
                } else {
                    return jit::context<std::complex<double>>::random_state_size;
                }
        }
    }

//------------------------------------------------------------------------------
///  @brief Construct a random state node.
///
@@ -1733,6 +1771,7 @@ extern "C" {
                    auto d = reinterpret_cast<graph_c_context_type<float> *> (c);
                    d->work = workflow::manager<float> (num);
                }
                break;

            case DOUBLE:
                if (c->safe_math) {
@@ -1742,6 +1781,7 @@ extern "C" {
                    auto d = reinterpret_cast<graph_c_context_type<double> *> (c);
                    d->work = workflow::manager<double> (num);
                }
                break;

            case COMPLEX_FLOAT:
                if (c->safe_math) {
@@ -1751,6 +1791,7 @@ extern "C" {
                    auto d = reinterpret_cast<graph_c_context_type<std::complex<float>> *> (c);
                    d->work = workflow::manager<std::complex<float>> (num);
                }
                break;

            case COMPLEX_DOUBLE:
                if (c->safe_math) {
@@ -1760,6 +1801,7 @@ extern "C" {
                    auto d = reinterpret_cast<graph_c_context_type<std::complex<double>> *> (c);
                    d->work = workflow::manager<std::complex<double>> (num);
                }
                break;
        }
    }

+20 −0
Original line number Diff line number Diff line
@@ -207,6 +207,18 @@ extern "C" {
    graph_node graph_log(STRUCT_TAG graph_c_context *c,
                         graph_node arg);

//------------------------------------------------------------------------------
///  @brief Create Pow node.
///
///  @param[in] c     The graph C context.
///  @param[in] left  The left opperand.
///  @param[in] right The right opperand.
///  @returns pow(left, right)
//------------------------------------------------------------------------------
    graph_node graph_pow(STRUCT_TAG graph_c_context *c,
                         graph_node left,
                         graph_node right);

//------------------------------------------------------------------------------
///  @brief Create imaginary error function node.
///
@@ -249,6 +261,14 @@ extern "C" {
                          graph_node left,
                          graph_node right);

//------------------------------------------------------------------------------
///  @brief Get random size.
///
///  @param[in] c The graph C context.
///  @return The random size.
//------------------------------------------------------------------------------
    size_t graph_random_size(STRUCT_TAG graph_c_context *c);

//------------------------------------------------------------------------------
///  @brief Construct a random state node.
///
+0 −1
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ namespace graph {
//------------------------------------------------------------------------------
///  @brief Construct a constant node from a vector.
///
///  @param[in] size Number of random states.
///  @param[in] seed Inital random seed.
//------------------------------------------------------------------------------
        random_state_node(const size_t size,
+2 −3
Original line number Diff line number Diff line
add_tool_target (xkorc cpp)

if (${USE_PCH})
    target_precompile_headers (xkorc REUSE_FROM xrays)
if (${USE_PCH} AND NOT ${BUILD_C_BINDING})
    target_precompile_headers (xrays_bench REUSE_FROM xrays)
endif ()
Loading