hotspot/test/native/utilities/test_json.cpp
author alanb
Thu, 01 Dec 2016 15:54:39 +0000
changeset 42309 21f9f3fbc302
parent 41671 9e0c6db4918a
child 42624 91e01fe9f1e3
permissions -rw-r--r--
8170599: compiler/** tests using ToolProvider.getSystemClassLoader failing Reviewed-by: hseigel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
     1
/*
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
     4
 *
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
     8
 *
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    13
 * accompanied this code).
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    14
 *
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    18
 *
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    21
 * questions.
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    22
 *
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    23
 */
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    24
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    25
#include "precompiled.hpp"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    26
#include "prims/jvm.h"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    27
#include "utilities/json.hpp"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    28
#include "unittest.hpp"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    29
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    30
class JSON_GTest : public JSON {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    31
public:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    32
    static void test(const char* json, bool valid);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    33
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    34
private:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    35
    JSON_GTest(const char* text);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    36
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    37
    void log(uint level, const char* format, ...) ATTRIBUTE_PRINTF(3, 4);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    38
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    39
    bool callback(JSON_TYPE t, JSON_VAL* v, uint level);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    40
    JSON_TYPE prev;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    41
};
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    42
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    43
void JSON_GTest::test(const char* text, bool should_pass) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    44
    JSON_GTest json(text);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    45
    if (should_pass) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    46
        ASSERT_TRUE(json.valid()) << "failed on a valid json string";
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    47
    } else {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    48
        ASSERT_FALSE(json.valid()) << "succeeded on an invalid json string";
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    49
    }
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    50
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    51
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    52
JSON_GTest::JSON_GTest(const char* text) : JSON(text, false, tty) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    53
    prev = JSON_NONE;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    54
    parse();
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    55
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    56
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
    57
TEST_VM(utilities, json_curly_braces) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    58
    JSON_GTest::test("{}", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    59
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    60
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
    61
TEST_VM(utilities, json_brackets) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    62
    JSON_GTest::test("[]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    63
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    64
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
    65
TEST_VM(utilities, json_space_braces) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    66
    JSON_GTest::test("  {  }  ", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    67
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    68
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
    69
TEST_VM(utilities, json_space_bracketes) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    70
    JSON_GTest::test("  [  ]  ", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    71
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    72
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
    73
TEST_VM(utilities, json_quoted_error) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    74
    JSON_GTest::test("\"error\"", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    75
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    76
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
    77
TEST_VM(utilities, json_error_string) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    78
    JSON_GTest::test("error", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    79
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    80
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
    81
TEST_VM(utilities, json_simple_integer) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    82
    JSON_GTest::test("1", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    83
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    84
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
    85
TEST_VM(utilities, json_siple_float) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    86
    JSON_GTest::test("1.2", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    87
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    88
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
    89
TEST_VM(utilities, json_simple_boolean_true) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    90
    JSON_GTest::test("true", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    91
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    92
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
    93
TEST_VM(utilities, json_simple_boolean_false) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    94
    JSON_GTest::test("false", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    95
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    96
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
    97
TEST_VM(utilities, json_simple_null) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    98
    JSON_GTest::test("null", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
    99
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   100
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   101
TEST_VM(utilities, json_one_element_int_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   102
    JSON_GTest::test("[ 1 ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   103
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   104
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   105
TEST_VM(utilities, json_int_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   106
    JSON_GTest::test("[ 1, ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   107
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   108
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   109
TEST_VM(utilities, json_one_element_bool_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   110
    JSON_GTest::test("[ true ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   111
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   112
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   113
TEST_VM(utilities, json_bool_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   114
    JSON_GTest::test("[ true, ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   115
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   116
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   117
TEST_VM(utilities, json_one_element_false_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   118
    JSON_GTest::test("[ false ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   119
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   120
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   121
TEST_VM(utilities, json_false_bool_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   122
    JSON_GTest::test("[ false, ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   123
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   124
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   125
TEST_VM(utilities, json_one_null_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   126
    JSON_GTest::test("[ null ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   127
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   128
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   129
TEST_VM(utilities, json_null_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   130
    JSON_GTest::test("[ null, ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   131
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   132
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   133
TEST_VM(utilities, json_one_empty_string_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   134
    JSON_GTest::test("[ \"\" ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   135
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   136
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   137
TEST_VM(utilities, json_empty_string_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   138
    JSON_GTest::test("[ \"\", ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   139
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   140
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   141
TEST_VM(utilities, json_single_string_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   142
    JSON_GTest::test("[ \"elem1\" ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   143
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   144
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   145
TEST_VM(utilities, json_string_comma_arrray) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   146
    JSON_GTest::test("[ \"elem1\", ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   147
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   148
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   149
TEST_VM(utilities, json_two_strings_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   150
    JSON_GTest::test("[ \"elem1\", \"elem2\" ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   151
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   152
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   153
TEST_VM(utilities, json_two_strings_comma_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   154
    JSON_GTest::test("[ \"elem1\", \"elem2\", ]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   155
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   156
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   157
TEST_VM(utilities, json_curly_braces_outside) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   158
    JSON_GTest::test("[ \"elem1\" ] { }", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   159
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   160
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   161
TEST_VM(utilities, json_element_in_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   162
    JSON_GTest::test("[ elem1, \"elem2\" ]", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   163
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   164
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   165
TEST_VM(utilities, json_incorrect_end_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   166
    JSON_GTest::test("[ \"elem1\"", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   167
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   168
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   169
TEST_VM(utilities, json_incorrect_string_end) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   170
    JSON_GTest::test("[ \"elem1 ]", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   171
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   172
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   173
TEST_VM(utilities, json_incorrect_end_of_two_elements_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   174
    JSON_GTest::test("[ \"elem1\", \"elem2\"", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   175
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   176
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   177
TEST_VM(utilities, json_incorrect_bool_true_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   178
    JSON_GTest::test("[ truefoo ]", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   179
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   180
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   181
TEST_VM(utilities, json_incorrect_bool_false_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   182
    JSON_GTest::test("[ falsefoo ]", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   183
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   184
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   185
TEST_VM(utilities, json_incorrect_null_array) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   186
    JSON_GTest::test("[ nullfoo ]", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   187
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   188
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   189
TEST_VM(utilities, json_key_pair) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   190
    JSON_GTest::test("{ key : 1 }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   191
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   192
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   193
TEST_VM(utilities, json_key_pair_comma) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   194
    JSON_GTest::test("{ key : 1, }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   195
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   196
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   197
TEST_VM(utilities, json_bool_true_key) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   198
    JSON_GTest::test("{ key : true }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   199
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   200
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   201
TEST_VM(utilities, json_bool_true_key_comma) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   202
    JSON_GTest::test("{ key : true, }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   203
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   204
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   205
TEST_VM(utilities, json_bool_false_key) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   206
    JSON_GTest::test("{ key : false }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   207
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   208
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   209
TEST_VM(utilities, json_bool_false_key_comma) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   210
    JSON_GTest::test("{ key : false, }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   211
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   212
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   213
TEST_VM(utilities, json_null_key) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   214
    JSON_GTest::test("{ key : null }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   215
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   216
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   217
TEST_VM(utilities, json_null_key_comma) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   218
    JSON_GTest::test("{ key : null, }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   219
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   220
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   221
TEST_VM(utilities, json_pair_of_empty_strings) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   222
    JSON_GTest::test("{ \"\" : \"\" }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   223
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   224
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   225
TEST_VM(utilities, json_pair_of_empty_strings_comma) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   226
    JSON_GTest::test("{ \"\" : \"\", }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   227
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   228
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   229
TEST_VM(utilities, json_pair_of_strings) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   230
    JSON_GTest::test("{ \"key1\" : \"val1\" }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   231
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   232
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   233
TEST_VM(utilities, json_pair_of_strings_comma) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   234
    JSON_GTest::test("{ \"key1\" : \"val1\", }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   235
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   236
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   237
TEST_VM(utilities, json_two_pairs_of_strings) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   238
    JSON_GTest::test("{ \"key1\" : \"val1\", \"key2\" : \"val2\" }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   239
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   240
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   241
TEST_VM(utilities, json_two_pairs_of_strings_comma) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   242
    JSON_GTest::test("{ \"key1\" : \"val1\", \"key2\" : \"val2\", }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   243
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   244
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   245
TEST_VM(utilities, json_array_outside) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   246
    JSON_GTest::test("{ \"key\" : \"val\" } [ \"error\" ]", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   247
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   248
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   249
TEST_VM(utilities, json_incorrect_object_end) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   250
    JSON_GTest::test("{ \"key\" : \"val\" ", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   251
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   252
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   253
TEST_VM(utilities, json_empty_comment) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   254
    JSON_GTest::test("/**/ { }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   255
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   256
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   257
TEST_VM(utilities, json_space_comment) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   258
    JSON_GTest::test("/* */ { }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   259
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   260
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   261
TEST_VM(utilities, json_comment) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   262
    JSON_GTest::test("/*foo*/ { }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   263
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   264
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   265
TEST_VM(utilities, json_star_comment) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   266
    JSON_GTest::test("/* *foo */ { }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   267
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   268
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   269
TEST_VM(utilities, json_stars_comment) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   270
    JSON_GTest::test("/* *foo* */ { }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   271
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   272
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   273
TEST_VM(utilities, json_special_comment) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   274
    JSON_GTest::test("/* /*foo */ { }", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   275
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   276
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   277
TEST_VM(utilities, json_comment_after) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   278
    JSON_GTest::test("{ } /* foo */", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   279
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   280
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   281
TEST_VM(utilities, json_comment_after_and_space) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   282
    JSON_GTest::test("{ } /* foo */ ", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   283
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   284
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   285
TEST_VM(utilities, json_one_line_empty_comment_after) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   286
    JSON_GTest::test("{ } //", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   287
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   288
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   289
TEST_VM(utilities, json_one_line_space_comment_after) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   290
    JSON_GTest::test("{ } // ", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   291
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   292
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   293
TEST_VM(utilities, json_one_line_comment_after) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   294
    JSON_GTest::test("{ } // foo", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   295
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   296
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   297
TEST_VM(utilities, json_incorrect_multiline_comment) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   298
    JSON_GTest::test("/* * / { }", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   299
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   300
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   301
TEST_VM(utilities, json_incorrect_multiline_comment_begin) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   302
    JSON_GTest::test("/ * */ { }", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   303
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   304
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   305
TEST_VM(utilities, json_oneline_comment_only) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   306
    JSON_GTest::test("// { }", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   307
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   308
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   309
TEST_VM(utilities, json_multiline_comment_only) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   310
    JSON_GTest::test("/* { } */", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   311
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   312
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   313
TEST_VM(utilities, json_multiline_comment_2) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   314
    JSON_GTest::test("/* { } */ ", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   315
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   316
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   317
TEST_VM(utilities, json_incorrectly_commented_object) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   318
    JSON_GTest::test("/* { } ", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   319
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   320
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   321
TEST_VM(utilities, json_missing_multiline_end) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   322
    JSON_GTest::test("{ } /* ", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   323
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   324
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   325
TEST_VM(utilities, json_missing_multiline_slash) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   326
    JSON_GTest::test("/* { } *", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   327
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   328
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   329
TEST_VM(utilities, json_commented_object_end) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   330
    JSON_GTest::test("{ /* } */", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   331
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   332
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   333
TEST_VM(utilities, json_commented_array_end) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   334
    JSON_GTest::test("[ /* ] */", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   335
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   336
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   337
TEST_VM(utilities, json_missing_object_end) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   338
    JSON_GTest::test("{ key : \"val\", /* } */", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   339
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   340
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   341
TEST_VM(utilities, json_missing_array_end) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   342
    JSON_GTest::test("[ \"val\", /* ] */", false);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   343
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   344
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   345
TEST_VM(utilities, json_key_values_1) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   346
    JSON_GTest::test("/* comment */{ key1 : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   347
            "{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   348
            " : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   349
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   350
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   351
TEST_VM(utilities, json_key_values_2) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   352
    JSON_GTest::test("/* comment */ { \"key1\" : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   353
            "{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   354
            " : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   355
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   356
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   357
TEST_VM(utilities, json_quoted_symbols) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   358
    JSON_GTest::test("/*comment*/{\"ff1 fsd\":{\"☃\":{\"☃\":[\"☃\",\"☃\"]},"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   359
            "\"☃\":true},\"☃\":[\"☃\"],\"foo\":\"☃\",}", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   360
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   361
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   362
TEST_VM(utilities, json_incorrect_key) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   363
    JSON_GTest::test("/* comment */ { key1 error : { \"☃\" : { \"☃\" : [ \"☃\","
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   364
            " \"☃\" ] }, \"☃\" : true }, \"baz\" : [ \"☃\" ], foo : \"☃\",}",
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   365
            false); // first key needs to be quoted since it contains a space
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   366
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   367
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   368
TEST_VM(utilities, json_array_with_newline) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   369
    JSON_GTest::test("[\n]", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   370
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   371
41671
9e0c6db4918a 8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents: 41335
diff changeset
   372
TEST_VM(utilities, json_directives_file) {
41335
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   373
    JSON_GTest::test(
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   374
            "[" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   375
            "   {"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   376
            "         // pattern to match against class+method+signature" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   377
            "         // leading and trailing wildcard (*) allowed" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   378
            "         match: \"foo.bar.*\"," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   379
            " " "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   380
            "         // override defaults for specified compiler" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   381
            "         // we may differentiate between levels too. TBD." "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   382
            "         c1:  {" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   383
            "           //override c1 presets " "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   384
            "           array_bounds_check_removal: false" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   385
            "         }," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   386
            "" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   387
            "         c2: {" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   388
            "           // control inlining of method" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   389
            "           // + force inline, - dont inline" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   390
            "           inline : [ \"+java.util.*\", \"-com.sun.*\"]," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   391
            "         }," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   392
            "" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   393
            "         // directives outside a specific preset applies to all compilers" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   394
            "         inline : [ \"+java.util.*\", \"-com.sun.*\"]," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   395
            "         print_assembly: true," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   396
            "         verify_oopmaps: true," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   397
            "         max_loop_unrolling: 5" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   398
            "   }," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   399
            "   {" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   400
            "         // matching several patterns require an array" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   401
            "         match: [\"baz.*\",\"frob*\"]," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   402
            "" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   403
            "         // only enable c1 for this directive" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   404
            "         // all enabled by default. Command disables all not listed" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   405
            "         enable: \"c1\"," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   406
            "" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   407
            "         // applies to all compilers" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   408
            "         // + force inline, - dont inline" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   409
            "         inline : [ \"+java.util.*\", \"-com.sun.*\"]," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   410
            "         print_inlining: true," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   411
            "" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   412
            "         // force matching compiles to be blocking/syncronous" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   413
            "         blocking_compile: true" "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   414
            "   }," "\n"
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   415
            "]" "\n", true);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   416
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   417
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   418
void JSON_GTest::log(uint indent, const char* format, ...) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   419
    if (prev != JSON_KEY) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   420
        for (uint i = 0; i < indent; i++) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   421
            _st->print("  ");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   422
        }
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   423
    }
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   424
    va_list args;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   425
    va_start(args, format);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   426
    _st->vprint(format, args);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   427
    va_end(args);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   428
}
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   429
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   430
bool JSON_GTest::callback(JSON_TYPE t, JSON_VAL* v, uint rlevel) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   431
    switch (t) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   432
        case JSON_OBJECT_BEGIN:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   433
            log(rlevel, "{\n");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   434
            prev = JSON_NONE; // Only care about JSON_KEY, to indent correctly
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   435
            return true;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   436
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   437
        case JSON_OBJECT_END:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   438
            log(rlevel, "},\n");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   439
            prev = JSON_NONE;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   440
            return true;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   441
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   442
        case JSON_ARRAY_BEGIN:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   443
            log(rlevel, "[\n");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   444
            prev = JSON_NONE;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   445
            return true;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   446
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   447
        case JSON_ARRAY_END:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   448
            log(rlevel, "],\n");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   449
            prev = JSON_NONE;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   450
            return true;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   451
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   452
        case JSON_KEY:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   453
            for (uint i = 0; i < rlevel; i++) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   454
                _st->print("  ");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   455
            }
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   456
            _st->print("<key>");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   457
            for (size_t i = 0; i < v->str.length; i++) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   458
                u_char c = v->str.start[i];
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   459
                if (c == 0) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   460
                    return false;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   461
                }
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   462
                _st->print("%c", c);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   463
            }
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   464
            _st->print(" : ");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   465
            prev = JSON_KEY;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   466
            return true;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   467
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   468
        case JSON_STRING:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   469
            if (prev != JSON_KEY) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   470
                for (uint i = 0; i < rlevel; i++) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   471
                    _st->print("  ");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   472
                }
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   473
            }
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   474
            _st->print("<str>");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   475
            for (size_t i = 0; i < v->str.length; i++) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   476
                u_char c = v->str.start[i];
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   477
                if (c == 0) {
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   478
                    return false;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   479
                }
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   480
                _st->print("%c", c);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   481
            }
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   482
            _st->print(",\n");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   483
            prev = JSON_NONE;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   484
            return true;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   485
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   486
        case JSON_NUMBER_INT:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   487
            log(rlevel, "<int>%" PRId64 ",\n", v->int_value);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   488
            prev = JSON_NONE;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   489
            return true;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   490
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   491
        case JSON_NUMBER_FLOAT:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   492
            log(rlevel, "<double>%lf,\n", v->double_value);
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   493
            prev = JSON_NONE;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   494
            return true;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   495
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   496
        case JSON_TRUE:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   497
            log(rlevel, "<true>,\n");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   498
            prev = JSON_NONE;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   499
            return true;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   500
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   501
        case JSON_FALSE:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   502
            log(rlevel, "<false>,\n");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   503
            prev = JSON_NONE;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   504
            return true;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   505
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   506
        case JSON_NULL:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   507
            log(rlevel, "<null>,\n");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   508
            prev = JSON_NONE;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   509
            return true;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   510
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   511
        default:
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   512
            error(INTERNAL_ERROR, "unknown JSON type");
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   513
            return false;
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   514
    }
27115e2e42cc 8156852: Convert JSON_test to Gtest
ppunegov
parents:
diff changeset
   515
}