1
0
Fork 0
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:
Roland Rabien 2024-11-18 08:52:50 -08:00
parent dc52aafe26
commit f5e77c483d

View file

@ -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})"));