OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 CHECK_EQ(0, FastD2I(0.345)); | 48 CHECK_EQ(0, FastD2I(0.345)); |
49 CHECK_EQ(1, FastD2I(1.234)); | 49 CHECK_EQ(1, FastD2I(1.234)); |
50 CHECK_EQ(1000000, FastD2I(1000000.123)); | 50 CHECK_EQ(1000000, FastD2I(1000000.123)); |
51 // Check that >> is implemented as arithmetic shift right. | 51 // Check that >> is implemented as arithmetic shift right. |
52 // If this is not true, then ArithmeticShiftRight() must be changed, | 52 // If this is not true, then ArithmeticShiftRight() must be changed, |
53 // There are also documented right shifts in assembler.cc of | 53 // There are also documented right shifts in assembler.cc of |
54 // int8_t and intptr_t signed integers. | 54 // int8_t and intptr_t signed integers. |
55 CHECK_EQ(-2, -8 >> 2); | 55 CHECK_EQ(-2, -8 >> 2); |
56 CHECK_EQ(-2, static_cast<int8_t>(-8) >> 2); | 56 CHECK_EQ(-2, static_cast<int8_t>(-8) >> 2); |
57 CHECK_EQ(-2, static_cast<int>(static_cast<intptr_t>(-8) >> 2)); | 57 CHECK_EQ(-2, static_cast<int>(static_cast<intptr_t>(-8) >> 2)); |
| 58 CHECK_EQ(INT_MAX, FastD2I(1.0e100)); |
| 59 CHECK_EQ(INT_MIN, FastD2I(-1.0e100)); |
| 60 CHECK_EQ(INT_MIN, FastD2I(NAN)); |
58 } | 61 } |
59 | 62 |
60 | 63 |
61 TEST(SNPrintF) { | 64 TEST(SNPrintF) { |
62 // Make sure that strings that are truncated because of too small | 65 // Make sure that strings that are truncated because of too small |
63 // buffers are zero-terminated anyway. | 66 // buffers are zero-terminated anyway. |
64 const char* s = "the quick lazy .... oh forget it!"; | 67 const char* s = "the quick lazy .... oh forget it!"; |
65 int length = StrLength(s); | 68 int length = StrLength(s); |
66 for (int i = 1; i < length * 2; i++) { | 69 for (int i = 1; i < length * 2; i++) { |
67 static const char kMarker = static_cast<char>(42); | 70 static const char kMarker = static_cast<char>(42); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 TEST(SequenceCollectorRegression) { | 203 TEST(SequenceCollectorRegression) { |
201 SequenceCollector<char> collector(16); | 204 SequenceCollector<char> collector(16); |
202 collector.StartSequence(); | 205 collector.StartSequence(); |
203 collector.Add('0'); | 206 collector.Add('0'); |
204 collector.AddBlock( | 207 collector.AddBlock( |
205 i::Vector<const char>("12345678901234567890123456789012", 32)); | 208 i::Vector<const char>("12345678901234567890123456789012", 32)); |
206 i::Vector<char> seq = collector.EndSequence(); | 209 i::Vector<char> seq = collector.EndSequence(); |
207 CHECK_EQ(0, strncmp("0123456789012345678901234567890123", | 210 CHECK_EQ(0, strncmp("0123456789012345678901234567890123", |
208 seq.start(), seq.length())); | 211 seq.start(), seq.length())); |
209 } | 212 } |
OLD | NEW |