jtx: json, memo funclets, fixes, improvements:

* Add json funclet
* Add memo funclet
* Add Env::trace
* Add PrettAmount regression test
* Fix PrettyAmount construction
* Make Env::trust balance-neutral
* Log parse errors during signing
This commit is contained in:
Vinnie Falco
2015-06-18 12:47:39 -07:00
parent 0062a260b9
commit cd5e36045c
12 changed files with 466 additions and 5 deletions

View File

@@ -110,6 +110,7 @@ public:
expect(to_string(XRP(.80)) == "0.8 XRP");
expect(to_string(XRP(.005)) == "5000 drops");
expect(to_string(XRP(0.1)) == "0.1 XRP");
expect(to_string(XRP(10000)) == "10000 XRP");
expect(to_string(drops(10)) == "10 drops");
expect(to_string(drops(123400000)) == "123.4 XRP");
expect(to_string(XRP(-5)) == "-5 XRP");
@@ -226,7 +227,7 @@ public:
env.fund(XRP(10000), "alice", gw);
env.require(balance("alice", USD(none)));
env.trust(USD(100), "alice");
env.require(balance("alice", XRP(10000) - drops(10)));
env.require(balance("alice", XRP(10000))); // fee refunded
env.require(balance("alice", USD(0)));
env(pay(gw, "alice", USD(10)), require(balance("alice", USD(10))));
@@ -413,6 +414,22 @@ public:
Env env(*this);
}
void
testMemo()
{
using namespace jtx;
Env env(*this);
env.fund(XRP(10000), "alice");
env(noop("alice"), memodata("data"));
env(noop("alice"), memoformat("format"));
env(noop("alice"), memotype("type"));
env(noop("alice"), memondata("format", "type"));
env(noop("alice"), memonformat("data", "type"));
env(noop("alice"), memontype("data", "format"));
env(noop("alice"), memo("data", "format", "type"));
env(noop("alice"), memo("data1", "format1", "type1"), memo("data2", "format2", "type2"));
}
void
run()
{
@@ -430,6 +447,7 @@ public:
testMultiSign();
testMultiSign2();
testTicket();
testMemo();
}
};