mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-25 02:04:23 +00:00
JSONUtils::getPointer unit tests
This commit is contained in:
parent
dc52aafe26
commit
f5e77c483d
1 changed files with 7 additions and 0 deletions
|
|
@ -223,6 +223,13 @@ public:
|
|||
, "lfoWaveform": "triangle"
|
||||
, "pitchEnvelope": { "rates": [94,67,95,60], "levels": [50,50,50,50] }
|
||||
})");
|
||||
|
||||
expect (JSONUtils::getPointer (obj, "/name", {}) == "PIANO 4");
|
||||
expect (JSONUtils::getPointer (obj, "/lfoSpeed", {}) == var (30));
|
||||
expect (JSONUtils::getPointer (obj, "/pitchEnvelope/rates/1", {}) == var (67));
|
||||
expect (JSONUtils::getPointer (obj, "/pitchEnvelope/levels/2", {}) == var (50));
|
||||
expect (JSONUtils::getPointer (obj, "/pitchEnvelope/levels/10", {}) == var());
|
||||
|
||||
expectDeepEqual (JSONUtils::setPointer (obj, "", "hello world"), var ("hello world"));
|
||||
expectDeepEqual (JSONUtils::setPointer (obj, "/lfoWaveform/foobar", "str"), std::nullopt);
|
||||
expectDeepEqual (JSONUtils::setPointer (JSON::parse (R"({"foo":0,"bar":1})"), "/foo", 2), JSON::parse (R"({"foo":2,"bar":1})"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue