File: lua.cpp

package info (click to toggle)
fityk 1.3.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,772 kB
  • sloc: cpp: 34,595; ansic: 4,676; python: 963; makefile: 384; sh: 119; xml: 91; java: 31; ruby: 27; perl: 25
file content (17 lines) | stat: -rw-r--r-- 472 bytes parent folder | download | duplicates (5)
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);
}