mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-15 11:36:36 +02:00
Fixed compilation error when index is not an int
(issue #381)
This commit is contained in:
@ -5,8 +5,8 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
// If you like this project, please add a star!
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
class JsonVariant_Subscript_Tests : public ::testing::Test {
|
||||
protected:
|
||||
@ -24,6 +24,9 @@ TEST_F(JsonVariant_Subscript_Tests, Array) {
|
||||
EXPECT_EQ(2, _variant.size());
|
||||
EXPECT_STREQ("element at index 0", _variant[0].asString());
|
||||
EXPECT_STREQ("element at index 1", _variant[1].asString());
|
||||
EXPECT_STREQ(
|
||||
"element at index 0",
|
||||
_variant[static_cast<unsigned char>(0)].asString()); // issue #381
|
||||
EXPECT_FALSE(_variant[-1].success());
|
||||
EXPECT_FALSE(_variant[3].success());
|
||||
EXPECT_FALSE(_variant["0"].success());
|
||||
|
Reference in New Issue
Block a user