/* Parse this buffer */ int parse_this_buffer (char *buffer, value *ivals, value ***cvals) { my_ivals = ivals; copy_into_parsebuffer (buffer, strlen (buffer), 0); reinit_ds (); reinit_textparsing (); transduce (); if (nrofparses && cvals) *cvals = my_cvals; return (nrofparses); };
TEST(range, start_stop_step_floating_point) { auto res = into_vector(range(2.0, 6.0, 1.2)); auto expected = std::vector<double> {{ 2.0, 3.2, 4.4, 5.6 }}; EXPECT_TRUE(transduce(map([](double x, double y) { EXPECT_DOUBLE_EQ(x, y); return true; }), last_rf, true, res, expected)); }
TEST(map, mapping_invoke) { auto v = std::vector<int> { 1, 2, 3, 6 }; EXPECT_EQ(transduce(map(free_times2), std::plus<int>{}, 1, v), 25); }
TEST(map, mapping) { auto v = std::vector<int> { 1, 2, 3, 6 }; auto times2 = [] (int x) { return x * 2; }; EXPECT_EQ(transduce(map(times2), std::plus<int>{}, 1, v), 25); }