Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "Headers/Defines.h"

#include "Scripting/Headers/Script.h"

namespace Divide {
    
TEST_MEMBER_FUNCTION(ScriptTestClass, eval, Simple)
{
    PreparePlatform();

    Script input("5.3 + 2.1");
    double result = 7.4;

    CHECK_EQUAL(input.eval<double>(), result);
}

TEST_MEMBER_FUNCTION(ScriptTestClass, eval, ExternalFunction)
{
    PreparePlatform();

    Script input("use(\"utility.chai\");"
                 "var my_fun = fun(x) { return x + 2; };"
                 "something(my_fun)");

    I32 variable = 0;
    auto testFunc = [&variable](const DELEGATE_CBK<I32, I32>& t_func) {
        variable = t_func(variable);
    };

    input.registerFunction(testFunc, "something");
    input.eval<void>();
    CHECK_EQUAL(variable, 2);
}

}; //namespace Divide

Commits for Divide-Framework/trunk/Source Code/UnitTests/Engine-Tests/Tests/ScriptingTests.cpp

Diff revisions: vs.
Revision Author Commited Message
851 Diff Diff IonutCava picture IonutCava Mon 06 Feb, 2017 23:38:14 +0000

[IonutCava]
- Replaced most RenderStage params with RenderStagePass types
- More work on water rendering

848 Diff Diff IonutCava picture IonutCava Mon 06 Feb, 2017 11:29:12 +0000

[IonutCava]
- Update Script unit tests to properly use fixtures

846 Diff Diff IonutCava picture IonutCava Fri 03 Feb, 2017 22:41:05 +0000

[IonutCava]
- More scripting work

845 Diff Diff IonutCava picture IonutCava Fri 03 Feb, 2017 14:36:26 +0000

[IonutCava]
- Hot reloading system cleanup
- More script system bug fixes

844 Diff Diff IonutCava picture IonutCava Thu 02 Feb, 2017 21:49:28 +0000

[IonutCava]
- More scripting prep work and experiments

843 Diff Diff IonutCava picture IonutCava Thu 02 Feb, 2017 17:03:33 +0000

[IonutCava]
- Add more matrix unit tests and fix discovered bugs
- Fix compile warning in ShaderProgram
- Rework script function binding and add unit test for this usecase

842 IonutCava picture IonutCava Wed 01 Feb, 2017 17:25:15 +0000

[IonutCava]
- Start to implement scripting support via ChaiScript: http://chaiscript.com/
- Cleanup DELEGATE_CBK alias