1. use snprintf for string

2. use ESCARGOT_LOG_INFO, ESCARGOT_LOG_ERROR
This commit is contained in:
Youngil Choi 2017-02-22 19:28:26 +09:00
commit 38dbe94d8d
8 changed files with 24 additions and 77 deletions

View file

@ -165,56 +165,3 @@ int main(int argc, char* argv[])
return 0;
}
/*
// small value & value test
Escargot::Object* obj = new Escargot::Object();
obj->m_values.push_back(Escargot::Value(1));
obj->m_values.push_back(Escargot::Value(-1));
obj->m_values.push_back(Escargot::Value(0xefffffff));
obj->m_values.push_back(Escargot::Value(0xffffffff));
obj->m_values.push_back(Escargot::Value(1.1));
auto obj2 = new Escargot::Object();
obj->m_values.push_back(Escargot::Value(obj2));
Escargot::Value v;
v = obj->m_values[0];
ASSERT(v.asNumber() == 1);
v = obj->m_values[1];
ASSERT(v.asNumber() == -1);
v = obj->m_values[2];
ASSERT(v.asNumber() == 0xefffffff);
v = obj->m_values[3];
ASSERT(v.asNumber() == 0xffffffff);
v = obj->m_values[4];
ASSERT(v.asNumber() == 1.1);
v = obj->m_values[5];
ASSERT(v == obj2);
uint64_t cnt = 0;
for (int64_t i = std::numeric_limits<int32_t>::min() ; i < std::numeric_limits<int32_t>::max(); i ++) {
Escargot::SmallValue smallValue = Escargot::Value(i);
RELEASE_ASSERT(Escargot::Value(smallValue).asNumber() == i);
cnt++;
if (cnt % 100000 == 0) {
printf("%lld\n", i);
}
}
*/
/* Custom allocator & Array iterator test
#include "runtime/ArrayObject.h"
size_t counter = 0;
Escargot::HeapObjectIteratorCallback callback =
[&counter](Escargot::ExecutionState& state, void* obj) {
Escargot::ArrayObject* arr = (Escargot::ArrayObject*) obj;
printf("ArrayObject %p with length %u\n", obj, arr->getLength(state));
counter++;
};
Escargot::ExecutionState state(context);
Escargot::ArrayObject::iterateArrays(state, callback);
printf("Array total count %zu\n", counter);
*/