mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-12 15:24:18 +00:00
Don't run the LV commands at all if fuzzing non-linkview
This commit is contained in:
parent
5eb18ed487
commit
510c049855
@ -67,6 +67,7 @@ static void run_commit(RealmState& state)
|
|||||||
|
|
||||||
static void run_lv_insert(RealmState& state, size_t pos, size_t target)
|
static void run_lv_insert(RealmState& state, size_t pos, size_t target)
|
||||||
{
|
{
|
||||||
|
if (!state.lv) return;
|
||||||
if (target < state.table.size() && pos <= state.lv->size()) {
|
if (target < state.table.size() && pos <= state.lv->size()) {
|
||||||
log("lv insert %zu %zu\n", pos, target);
|
log("lv insert %zu %zu\n", pos, target);
|
||||||
state.lv->insert(pos, target);
|
state.lv->insert(pos, target);
|
||||||
@ -75,6 +76,7 @@ static void run_lv_insert(RealmState& state, size_t pos, size_t target)
|
|||||||
|
|
||||||
static void run_lv_set(RealmState& state, size_t pos, size_t target)
|
static void run_lv_set(RealmState& state, size_t pos, size_t target)
|
||||||
{
|
{
|
||||||
|
if (!state.lv) return;
|
||||||
if (target < state.table.size() && pos < state.lv->size()) {
|
if (target < state.table.size() && pos < state.lv->size()) {
|
||||||
log("lv set %zu %zu\n", pos, target);
|
log("lv set %zu %zu\n", pos, target);
|
||||||
// We can't reliably detect self-assignment for verification, so don't do it
|
// We can't reliably detect self-assignment for verification, so don't do it
|
||||||
@ -85,6 +87,7 @@ static void run_lv_set(RealmState& state, size_t pos, size_t target)
|
|||||||
|
|
||||||
static void run_lv_move(RealmState& state, size_t from, size_t to)
|
static void run_lv_move(RealmState& state, size_t from, size_t to)
|
||||||
{
|
{
|
||||||
|
if (!state.lv) return;
|
||||||
if (from < state.lv->size() && to < state.lv->size()) {
|
if (from < state.lv->size() && to < state.lv->size()) {
|
||||||
log("lv move %zu %zu\n", from, to);
|
log("lv move %zu %zu\n", from, to);
|
||||||
// FIXME: only do the move if it has an effect to avoid getting a
|
// FIXME: only do the move if it has an effect to avoid getting a
|
||||||
@ -100,6 +103,7 @@ static void run_lv_move(RealmState& state, size_t from, size_t to)
|
|||||||
|
|
||||||
static void run_lv_swap(RealmState& state, size_t ndx1, size_t ndx2)
|
static void run_lv_swap(RealmState& state, size_t ndx1, size_t ndx2)
|
||||||
{
|
{
|
||||||
|
if (!state.lv) return;
|
||||||
if (ndx1 < state.lv->size() && ndx2 < state.lv->size()) {
|
if (ndx1 < state.lv->size() && ndx2 < state.lv->size()) {
|
||||||
log("lv swap %zu %zu\n", ndx1, ndx2);
|
log("lv swap %zu %zu\n", ndx1, ndx2);
|
||||||
if (state.lv->get(ndx1).get_index() != state.lv->get(ndx2).get_index()) {
|
if (state.lv->get(ndx1).get_index() != state.lv->get(ndx2).get_index()) {
|
||||||
@ -114,6 +118,7 @@ static void run_lv_swap(RealmState& state, size_t ndx1, size_t ndx2)
|
|||||||
|
|
||||||
static void run_lv_remove(RealmState& state, size_t pos)
|
static void run_lv_remove(RealmState& state, size_t pos)
|
||||||
{
|
{
|
||||||
|
if (!state.lv) return;
|
||||||
if (pos < state.lv->size()) {
|
if (pos < state.lv->size()) {
|
||||||
log("lv remove %zu\n", pos);
|
log("lv remove %zu\n", pos);
|
||||||
state.lv->remove(pos);
|
state.lv->remove(pos);
|
||||||
@ -122,6 +127,7 @@ static void run_lv_remove(RealmState& state, size_t pos)
|
|||||||
|
|
||||||
static void run_lv_remove_target(RealmState& state, size_t pos)
|
static void run_lv_remove_target(RealmState& state, size_t pos)
|
||||||
{
|
{
|
||||||
|
if (!state.lv) return;
|
||||||
if (pos < state.lv->size()) {
|
if (pos < state.lv->size()) {
|
||||||
log("lv target remove %zu\n", pos);
|
log("lv target remove %zu\n", pos);
|
||||||
state.lv->remove_target_row(pos);
|
state.lv->remove_target_row(pos);
|
||||||
|
@ -162,7 +162,11 @@ static void test(Realm::Config const& config, SharedRealm& r, SharedRealm& r2, s
|
|||||||
*r2,
|
*r2,
|
||||||
state.coordinator,
|
state.coordinator,
|
||||||
*r2->read_group()->get_table("class_object"),
|
*r2->read_group()->get_table("class_object"),
|
||||||
|
#if FUZZ_LINKVIEW
|
||||||
r2->read_group()->get_table("class_linklist")->get_linklist(0, 0),
|
r2->read_group()->get_table("class_linklist")->get_linklist(0, 0),
|
||||||
|
#else
|
||||||
|
{},
|
||||||
|
#endif
|
||||||
state.uid,
|
state.uid,
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user