fix the SparseVector and SparseTable unit tests

also, throw std::logic_error in the OPM_ERROR_IF macro