2021-01-04 09:47:30 +08:00
|
|
|
#include "tkc/fscript.h"
|
|
|
|
#include "tkc/object_default.h"
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
|
|
TEST(FExr, cksum) {
|
|
|
|
value_t v;
|
|
|
|
object_t* obj = object_default_create();
|
|
|
|
|
|
|
|
fscript_eval(obj, "cksum(\"1\")", &v);
|
2021-01-04 10:44:15 +08:00
|
|
|
ASSERT_EQ(value_uint32(&v), 65486);
|
2021-01-04 09:47:30 +08:00
|
|
|
value_reset(&v);
|
2021-01-20 13:41:57 +08:00
|
|
|
|
2021-01-04 09:47:30 +08:00
|
|
|
fscript_eval(obj, "cksum(\"123\")", &v);
|
2021-01-04 10:44:15 +08:00
|
|
|
ASSERT_EQ(value_uint32(&v), 65385);
|
2021-01-04 09:47:30 +08:00
|
|
|
value_reset(&v);
|
|
|
|
|
|
|
|
OBJECT_UNREF(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(FExr, crc16) {
|
|
|
|
value_t v;
|
|
|
|
object_t* obj = object_default_create();
|
|
|
|
|
|
|
|
fscript_eval(obj, "crc16(\"1\")", &v);
|
2021-01-04 10:44:15 +08:00
|
|
|
ASSERT_EQ(value_uint32(&v), 53362);
|
2021-01-04 09:47:30 +08:00
|
|
|
value_reset(&v);
|
2021-01-20 13:41:57 +08:00
|
|
|
|
2021-01-04 09:47:30 +08:00
|
|
|
fscript_eval(obj, "crc16(\"123\")", &v);
|
2021-01-04 10:44:15 +08:00
|
|
|
ASSERT_EQ(value_uint32(&v), 40116);
|
2021-01-04 09:47:30 +08:00
|
|
|
value_reset(&v);
|
|
|
|
|
|
|
|
OBJECT_UNREF(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(FExr, crc32) {
|
|
|
|
value_t v;
|
|
|
|
object_t* obj = object_default_create();
|
|
|
|
|
|
|
|
fscript_eval(obj, "crc32(\"1\")", &v);
|
2021-01-04 10:44:15 +08:00
|
|
|
ASSERT_EQ(value_uint32(&v), 2212294583);
|
2021-01-04 09:47:30 +08:00
|
|
|
value_reset(&v);
|
2021-01-20 13:41:57 +08:00
|
|
|
|
2021-01-04 09:47:30 +08:00
|
|
|
fscript_eval(obj, "crc32(\"123\")", &v);
|
2021-01-04 10:44:15 +08:00
|
|
|
ASSERT_EQ(value_uint32(&v), 2286445522);
|
2021-01-04 09:47:30 +08:00
|
|
|
value_reset(&v);
|
|
|
|
|
|
|
|
OBJECT_UNREF(obj);
|
|
|
|
}
|