Index: test/cctest/test-api.cc |
=================================================================== |
--- test/cctest/test-api.cc (revision 3009) |
+++ test/cctest/test-api.cc (working copy) |
@@ -702,6 +702,75 @@ |
} |
+THREADED_TEST(TinyInteger) { |
+ v8::HandleScope scope; |
+ LocalContext env; |
+ int32_t value = 239; |
+ Local<v8::Integer> value_obj = v8::Integer::New(value); |
+ CHECK_EQ(int64_t(value), value_obj->Value()); |
+} |
+ |
+ |
+THREADED_TEST(BigSmiInteger) { |
+ v8::HandleScope scope; |
+ LocalContext env; |
+ int32_t value = (1 << 30) - 1; |
+ CHECK(i::Smi::IsValid(value)); |
+ CHECK(!i::Smi::IsValid(value + 1)); |
+ Local<v8::Integer> value_obj = v8::Integer::New(value); |
+ CHECK_EQ(int64_t(value), value_obj->Value()); |
+} |
+ |
+ |
+THREADED_TEST(BigInteger) { |
+ v8::HandleScope scope; |
+ LocalContext env; |
+ int32_t value = (1 << 30) + 1; |
+ CHECK(!i::Smi::IsValid(value)); |
+ Local<v8::Integer> value_obj = v8::Integer::New(value); |
+ CHECK_EQ(int64_t(value), value_obj->Value()); |
+} |
+ |
+ |
+THREADED_TEST(TinyUnsignedInteger) { |
+ v8::HandleScope scope; |
+ LocalContext env; |
+ uint32_t value = 239; |
+ Local<v8::Integer> value_obj = v8::Integer::New(value); |
+ CHECK_EQ(int64_t(value), value_obj->Value()); |
+} |
+ |
+ |
+THREADED_TEST(BigUnsignedSmiInteger) { |
+ v8::HandleScope scope; |
+ LocalContext env; |
+ uint32_t value = (1 << 30) - 1; |
+ CHECK(i::Smi::IsValid(value)); |
+ CHECK(!i::Smi::IsValid(value + 1)); |
+ Local<v8::Integer> value_obj = v8::Integer::New(value); |
+ CHECK_EQ(int64_t(value), value_obj->Value()); |
+} |
+ |
+ |
+THREADED_TEST(BigUnsignedInteger) { |
+ v8::HandleScope scope; |
+ LocalContext env; |
+ uint32_t value = (1 << 30) + 1; |
+ CHECK(!i::Smi::IsValid(value)); |
+ Local<v8::Integer> value_obj = v8::Integer::New(value); |
+ CHECK_EQ(int64_t(value), value_obj->Value()); |
+} |
+ |
+ |
+THREADED_TEST(OutOfSignedRangeUnsignedInteger) { |
+ v8::HandleScope scope; |
+ LocalContext env; |
+ uint32_t value = uint32_t(0xffffffff); |
+ Local<v8::Integer> value_obj = v8::Integer::New(value); |
+ CHECK_EQ(int64_t(value), value_obj->Value()); |
+} |
+ |
+ |
THREADED_TEST(Number) { |
v8::HandleScope scope; |
LocalContext env; |