Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: base/json/json_writer_unittest.cc

Issue 6248026: Rename Real* to Double* in values.* and dependent files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More renames Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/json/json_writer.h" 5 #include "base/json/json_writer.h"
6 #include "base/values.h" 6 #include "base/values.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace base { 9 namespace base {
10 10
(...skipping 11 matching lines...) Expand all
22 ASSERT_EQ("{}", output_js); 22 ASSERT_EQ("{}", output_js);
23 delete root; 23 delete root;
24 24
25 // Test empty list 25 // Test empty list
26 root = new ListValue; 26 root = new ListValue;
27 JSONWriter::Write(root, false, &output_js); 27 JSONWriter::Write(root, false, &output_js);
28 ASSERT_EQ("[]", output_js); 28 ASSERT_EQ("[]", output_js);
29 delete root; 29 delete root;
30 30
31 // Test Real values should always have a decimal or an 'e'. 31 // Test Real values should always have a decimal or an 'e'.
32 root = Value::CreateRealValue(1.0); 32 root = Value::CreateDoubleValue(1.0);
33 JSONWriter::Write(root, false, &output_js); 33 JSONWriter::Write(root, false, &output_js);
34 ASSERT_EQ("1.0", output_js); 34 ASSERT_EQ("1.0", output_js);
35 delete root; 35 delete root;
36 36
37 // Test Real values in the the range (-1, 1) must have leading zeros 37 // Test Real values in the the range (-1, 1) must have leading zeros
38 root = Value::CreateRealValue(0.2); 38 root = Value::CreateDoubleValue(0.2);
39 JSONWriter::Write(root, false, &output_js); 39 JSONWriter::Write(root, false, &output_js);
40 ASSERT_EQ("0.2", output_js); 40 ASSERT_EQ("0.2", output_js);
41 delete root; 41 delete root;
42 42
43 // Test Real values in the the range (-1, 1) must have leading zeros 43 // Test Real values in the the range (-1, 1) must have leading zeros
44 root = Value::CreateRealValue(-0.8); 44 root = Value::CreateDoubleValue(-0.8);
45 JSONWriter::Write(root, false, &output_js); 45 JSONWriter::Write(root, false, &output_js);
46 ASSERT_EQ("-0.8", output_js); 46 ASSERT_EQ("-0.8", output_js);
47 delete root; 47 delete root;
48 48
49 // Writer unittests like empty list/dict nesting, 49 // Writer unittests like empty list/dict nesting,
50 // list list nesting, etc. 50 // list list nesting, etc.
51 DictionaryValue root_dict; 51 DictionaryValue root_dict;
52 ListValue* list = new ListValue; 52 ListValue* list = new ListValue;
53 root_dict.Set("list", list); 53 root_dict.Set("list", list);
54 DictionaryValue* inner_dict = new DictionaryValue; 54 DictionaryValue* inner_dict = new DictionaryValue;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 ASSERT_EQ("{\"a.b\":3,\"c\":2,\"d.e.f\":{\"g.h.i.j\":1}}", output_js); 89 ASSERT_EQ("{\"a.b\":3,\"c\":2,\"d.e.f\":{\"g.h.i.j\":1}}", output_js);
90 90
91 DictionaryValue period_dict3; 91 DictionaryValue period_dict3;
92 period_dict3.Set("a.b", Value::CreateIntegerValue(2)); 92 period_dict3.Set("a.b", Value::CreateIntegerValue(2));
93 period_dict3.SetWithoutPathExpansion("a.b", Value::CreateIntegerValue(1)); 93 period_dict3.SetWithoutPathExpansion("a.b", Value::CreateIntegerValue(1));
94 JSONWriter::Write(&period_dict3, false, &output_js); 94 JSONWriter::Write(&period_dict3, false, &output_js);
95 ASSERT_EQ("{\"a\":{\"b\":2},\"a.b\":1}", output_js); 95 ASSERT_EQ("{\"a\":{\"b\":2},\"a.b\":1}", output_js);
96 } 96 }
97 97
98 } // namespace base 98 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698