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

Side by Side Diff: test/cctest/test-conversions.cc

Issue 3564011: During StringToDouble negative exponents may be less than -999 with a result ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 2 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
« no previous file with comments | « src/conversions.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 2
3 #include <stdlib.h> 3 #include <stdlib.h>
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "platform.h" 7 #include "platform.h"
8 #include "cctest.h" 8 #include "cctest.h"
9 9
10 using namespace v8::internal; 10 using namespace v8::internal;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 "6998291015625000000000000000000000000000000000e-308"; 161 "6998291015625000000000000000000000000000000000e-308";
162 162
163 CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS)); 163 CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS));
164 164
165 // Changes the result of strtod (at least in glibc implementation). 165 // Changes the result of strtod (at least in glibc implementation).
166 num[sizeof(num) - 8] = '1'; 166 num[sizeof(num) - 8] = '1';
167 167
168 CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS)); 168 CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS));
169 } 169 }
170 170
171 TEST(MinimumExponent) {
172 // Same test but with different point-position.
173 char num[] =
174 "445014771701440202508199667279499186358524265859260511351695091"
175 "228726223124931264069530541271189424317838013700808305231545782"
176 "515453032382772695923684574304409936197089118747150815050941806"
177 "048037511737832041185193533879641611520514874130831632725201246"
178 "060231058690536206311752656217652146466431814205051640436322226"
179 "680064743260560117135282915796422274554896821334728738317548403"
180 "413978098469341510556195293821919814730032341053661708792231510"
181 "873354131880491105553390278848567812190177545006298062245710295"
182 "816371174594568773301103242116891776567137054973871082078224775"
183 "842509670618916870627821633352993761380751142008862499795052791"
184 "018709663463944015644907297315659352441231715398102212132212018"
185 "470035807616260163568645811358486831521563686919762403704226016"
186 "998291015625000000000000000000000000000000000e-1108";
187
188 CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS));
189
190 // Changes the result of strtod (at least in glibc implementation).
191 num[sizeof(num) - 8] = '1';
192
193 CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS));
194 }
195
196
197 TEST(MaximumExponent) {
198 char num[] = "0.16e309";
199
200 CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS));
201 }
202
171 203
172 TEST(ExponentNumberStr) { 204 TEST(ExponentNumberStr) {
173 CHECK_EQ(1e1, StringToDouble("1e1", NO_FLAGS)); 205 CHECK_EQ(1e1, StringToDouble("1e1", NO_FLAGS));
174 CHECK_EQ(1e1, StringToDouble("1e+1", NO_FLAGS)); 206 CHECK_EQ(1e1, StringToDouble("1e+1", NO_FLAGS));
175 CHECK_EQ(1e-1, StringToDouble("1e-1", NO_FLAGS)); 207 CHECK_EQ(1e-1, StringToDouble("1e-1", NO_FLAGS));
176 CHECK_EQ(1e100, StringToDouble("1e+100", NO_FLAGS)); 208 CHECK_EQ(1e100, StringToDouble("1e+100", NO_FLAGS));
177 CHECK_EQ(1e-100, StringToDouble("1e-100", NO_FLAGS)); 209 CHECK_EQ(1e-100, StringToDouble("1e-100", NO_FLAGS));
178 CHECK_EQ(1e-106, StringToDouble(".000001e-100", NO_FLAGS)); 210 CHECK_EQ(1e-106, StringToDouble(".000001e-100", NO_FLAGS));
179 } 211 }
180 212
(...skipping 27 matching lines...) Expand all
208 CHECK(EightBit1::is_valid(i)); 240 CHECK(EightBit1::is_valid(i));
209 x = EightBit1::encode(i); 241 x = EightBit1::encode(i);
210 CHECK_EQ(i, EightBit1::decode(x)); 242 CHECK_EQ(i, EightBit1::decode(x));
211 CHECK(EightBit2::is_valid(i)); 243 CHECK(EightBit2::is_valid(i));
212 x = EightBit2::encode(i); 244 x = EightBit2::encode(i);
213 CHECK_EQ(i, EightBit2::decode(x)); 245 CHECK_EQ(i, EightBit2::decode(x));
214 } 246 }
215 CHECK(!EightBit1::is_valid(256)); 247 CHECK(!EightBit1::is_valid(256));
216 CHECK(!EightBit2::is_valid(256)); 248 CHECK(!EightBit2::is_valid(256));
217 } 249 }
OLDNEW
« no previous file with comments | « src/conversions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698