File: lua.cpp

package info (click to toggle)
fityk 1.3.1-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 3,784 kB
  • sloc: cpp: 34,396; ansic: 4,673; python: 971; makefile: 366; sh: 117; java: 31; ruby: 27; perl: 25; xml: 16
file content (17 lines) | stat: -rw-r--r-- 472 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

#include <boost/scoped_ptr.hpp>
#include <string>
#include "fityk/fityk.h"
#include "fityk/logic.h"
#include "fityk/luabridge.h"
#include "catch.hpp"

TEST_CASE("formatted F:execute", "") {
    boost::scoped_ptr<fityk::Fityk> fik(new fityk::Fityk);
    fityk::Full* priv = fik->priv();
    std::string str = "a=123.456; F:execute('$v = %g' % a)";
    priv->lua_bridge()->exec_lua_string(str);
    double v = fik->get_variable("v")->value();
    REQUIRE(v == 123.456);
}