unitizer icon indicating copy to clipboard operation
unitizer copied to clipboard

More Comprehensive State Integrity Checking

Open brodieG opened this issue 7 years ago • 0 comments

Related to #197, it would be good to confirm that all the values in [email protected][[i]]@glob.indices actually map to a value in [email protected] when unitizers are stored and loaded. There is some dummy code commented out in R/load.R load() as of 812212b that does this, also copied here:

    # # check for and normalize state issues; this came up as a result of #197
    # # where our state objects were corrupted; really this should be handled
    # # in a more systematic way like we do for broader validation; if this
    # # happens more often we can look into that;
    # # NOTE: figured out what was going on here so commenting this out for now

    # ref.indices <- do.call(
    #   cbind,
    #   lapply(
    #     unitizers[[i]]@items.ref,
    #     function(z) as.integer(slot(z, "glob.indices"))
    #   )
    # )
    # ref.state <- lapply(
    #   slotNames(unitizers[[i]]@state.ref),
    #   function(z) length(slot(unitizers[[i]]@state.ref, z))
    # )
    # if(!identical(names(ref.state), names(ref.indices)))
    #   stop(
    #     "Internal error: incompatible global index structure; ",
    #     "contact maintainer"
    #   )

    # if(
    #   any(
    #     unlist(
    #       Map(
    #         function(v, w) any(v > w),
    #         split(ref.indices, row(ref.indices), ref.state), ref.state
    #   ) ) )
    # ) {
    #   meta_word_msg(
    #     "Unitizer ", i, " has corrupted state indices, we are resetting ",
    #     "them to NULL, which means review of reference tests will not ",
    #     "correctly reflect the reference states.  This is not expected ",
    #     "behavior and you should contact maintainer if it persists.", sep=""
    #   )
    #   glob.ind.def <- new("unitizerGlobalIndices")
    #   for(j in seq_along(unitizers[[i]]@items.ref))
    #     unitizers[[i]]@items.ref[[j]]@glob.indices <- glob.ind.def
    # }

brodieG avatar Feb 23 '17 02:02 brodieG