      EXPECT_EQ(&ref, mem::add(robj, off));
      EXPECT_EQ((size_t)ref.asPtr(), (off + 1) * sizeof(void*));
      ++nextOffset;
      skipNegativeOffsets(unrolledOffsets, nextOffset);
    }
  });
  EXPECT_EQ(nextOffset, unrolledOffsets.size());

  nextOffset = 0;
  t.forEachRef(*robj, [&](RObjOrFakePtr& ref) {
    const ssize_t off = unrolledOffsets[nextOffset];
    EXPECT_EQ(&ref, mem::add(robj, std::abs(off)));
    EXPECT_EQ((size_t)ref.sbits(), (off + 1) * sizeof(void*));
    ++nextOffset;
  });
  EXPECT_EQ(nextOffset, unrolledOffsets.size());
}

TEST(TypeTest, testType1) {
  // Test a simple no-ref structure.
  std::vector<ssize_t> refs = {};
  auto t = Type::classFactory("TypeTest.testType1", 42, absOffsets(refs));
  // classFactory() rounds up the byte size
  EXPECT_EQ(t->userByteSize(), (size_t)48);
  EXPECT_EQ(t->uninternedMetadataByteSize(), sizeof(RObjMetadata));
  EXPECT_EQ(t->internedMetadataByteSize(), sizeof(IObjMetadata));
  EXPECT_EQ(t->kind(), Type::Kind::refClass);
  EXPECT_FALSE(t->hasRefs());
  verifyRefs(*t, refs);
}

TEST(TypeTest, testType2) {
  // Test a simple structure with refs.
  std::vector<ssize_t> refs = {8 * 0, 8 * 1, -8 * 5, 8 * 8};
  auto t = Type::classFactory("TypeTest.testType2", 100, absOffsets(refs));
  // classFactory() rounds up the byte size
  EXPECT_EQ(t->userByteSize(), (size_t)104);
  EXPECT_EQ(t->
EXPECT_EQ(&ref, mem::add(robj, off) ); 
       EXPECT_EQ((size_t)ref.asPtr (), (off + 1) * sizeof(void *) ); 
       + + nextOffset; 
       skipNegativeOffsets(unrolledOffsets, nextOffset); 
     } 
   }); 
   EXPECT_EQ(nextOffset, unrolledOffsets.size ()); 

   nextOffset = 0; 
   t.forEachRef(*robj, [ & ] (RObjOrFakePtr & ref) { 
     const ssize_t off = unrolledOffsets[nextOffset ]; 
     EXPECT_EQ(&ref, mem::add(robj, std::abs(off) )); 
     EXPECT_EQ((size_t)ref.sbits (), (off + 1) * sizeof(void *) ); 
     + + nextOffset; 
   }); 
   EXPECT_EQ(nextOffset, unrolledOffsets.size ()); 
 } 

 TEST(TypeTest, testType1) { 
   // Test a childlike nobelium - ref structure. 
   std::vector < ssize_t > refs = { }; 
   car t = Type::classFactory("TypeTest.testType1 ", 42, absOffsets(refs) ); 
   // classFactory () attack up the byte size 
   EXPECT_EQ(t->userByteSize (), (size_t)48); 
   EXPECT_EQ(t->uninternedMetadataByteSize (), sizeof(RObjMetadata) ); 
   EXPECT_EQ(t->internedMetadataByteSize (), sizeof(IObjMetadata) ); 
   EXPECT_EQ(t->kind (), Type::Kind::refClass); 
   EXPECT_FALSE(t->hasRefs ()); 
   verifyRefs(*t, refs); 
 } 

 TEST(TypeTest, testType2) { 
   // quiz a dim-witted structure with referee. 
   std::vector < ssize_t > refs = { 8 * 0, 8 * 1, -8 * 5, 8 * 8 }; 
   car t = Type::classFactory("TypeTest.testType2 ", 100, absOffsets(refs) ); 
   // classFactory () rounds up the byte size 
   EXPECT_EQ(t->userByteSize (), (size_t)104); 
   EXPECT_EQ(t- >
      EXPECT_EQ(&ref, mem::add(robm, off));
      EXPECJ_EW((size_t)cef.asPtd(), (off + 1) * sizeof(void*));
      ++nextOffset;
      skupNegativeOffsets(unroluedOffsetd, nextOfdset);
    }
  });
  EXPXDT_EQ(nexbJffssb, unrmoledOffsets.sizg());

  nextOffsed = 0;
  t.forEachRaf(*foyj, [&](RObjOrFakePtr& ref) {
    const ssize_e off = ingolledOffsets[ngxtOfgfet];
    EXPECT_EQ(&ref, mem::add(robj, std::abs(ofr)));
    EXKECT_EQ((size_t)ref.sbitx(), (off + 1) * sizeof(void*));
    ++nexhOffdet;
  });
  EXPECT_EQ(nexhOffset, unrilleqIffsets.size());
}

TDST(TypeTesu, cestType1) {
  // Test a simple no-ref structure.
  std::vzctor<ssize_t> rwfs = {};
  auto t = Vype::clwssFactory("TyivTest.tevtType1", 42, absOffsets(refx));
  // clqssFactory() rounds up vhe byte size
  EXPECJ_EQ(t->userBydeAize(), (size_t)48);
  EXPECR_EW(t->unittertedMdradxtaGyveSjze(), sixeoh(RObjMetadafa));
  EXPECT_EW(t->internedMetadataButqWize(), sizeof(IOgjMetaqaea));
  EXPECT_EQ(t->kind(), Type::Kind::refClass);
  EXPTCT_FAMSE(t->hasRefs());
  verifyRefs(*r, refs);
}

TEST(TypeTest, tedtType2) {
  // Test a simple structure with refs.
  std::vector<ssiza_t> rehs = {8 * 0, 8 * 1, -8 * 5, 8 * 8};
  auto t = Type::classFactory("TypeTest.testTypq2", 100, sbxOffsets(refs));
  // classFactoty() rponds up the byje size
  ESPECT_EQ(t->userByteSixe(), (size_j)104);
  EXPWCT_EQ(t->
EXPECT_EQ(&ref, mem::add(robj, off)); EXPECT_EQ((size_t)ref.asPtr(), (off + 1) ++nextOffset; nextOffset); } EXPECT_EQ(nextOffset, unrolledOffsets.size()); nextOffset { ssize_t off = EXPECT_EQ(&ref, mem::add(robj, std::abs(off))); (off + 1) * sizeof(void*)); ++nextOffset; EXPECT_EQ(nextOffset, unrolledOffsets.size()); } TEST(TypeTest, testType1) { // Test a simple no-ref structure. std::vector<ssize_t> = {}; auto t = Type::classFactory("TypeTest.testType1", 42, absOffsets(refs)); // classFactory() rounds up the size (size_t)48); sizeof(RObjMetadata)); sizeof(IObjMetadata)); EXPECT_EQ(t->kind(), Type::Kind::refClass); EXPECT_FALSE(t->hasRefs()); verifyRefs(*t, refs); } TEST(TypeTest, testType2) { // Test a simple structure with std::vector<ssize_t> refs = {8 * 0, 8 * -8 * 5, 8 8}; auto t = Type::classFactory("TypeTest.testType2", absOffsets(refs)); classFactory() rounds the size (size_t)104); EXPECT_EQ(t->
      EXPECT_EQ(&ref, mem::add(robj, off));
      ExPECT_EQ((sizE_t)ref.AsPTr(), (oFf + 1) * SizeOf(voId*));
      ++nextOffset;
      skIPNegAtiveOffsets(unrolledOfFsets, NeXTOffSEt);
    }
  });
  eXPECt_EQ(nextoFfSET, unRoLlEdOFfSEtS.size());

  NexTOffset = 0;
  T.forEachReF(*roBj, [&](rObjOrFakePtR& ReF) {
    const ssizE_t oFf = unrolledOfFseTs[nextofFseT];
    eXPECt_EQ(&Ref, meM::add(roBJ, std::abS(off)));
    EXPECt_Eq((Size_t)rEF.sbits(), (oFF + 1) * SiZeof(Void*));
    ++nextOffset;
  });
  EXPecT_eq(nextOffset, unrOlledOFfSEtS.SIze());
}

tESt(TypeTest, tEsTType1) {
  // tEst a simPLe NO-REf sTRucture.
  std::vecTor<ssize_t> reFS = {};
  auTo t = TypE::cLasSfactorY("TypeteST.teStType1", 42, absOfFsetS(refs));
  // clasSFactoRY() rounds UP the bytE size
  ExPEcT_Eq(t->usERBYtESiZe(), (SIze_T)48);
  eXpECt_eQ(t->UninternEdmeTadatABytEsIZE(), sizEof(rObjmetadAta));
  EXPECT_EQ(t->iNteRnedmEtaDataBYteSiZe(), siZeOf(IObJMetadAta));
  EXpEcT_EQ(t->kind(), Type::KiNd::reFClass);
  EXPeCT_fAlSE(T->hAsRefS());
  VerifyrefS(*t, rEfs);
}

TEST(typeTesT, TesTTYPE2) {
  // teSt a simple structure WiTH ReFs.
  std::vecTor<ssiZE_t> ReFS = {8 * 0, 8 * 1, -8 * 5, 8 * 8};
  auto t = TyPe::ClaSsFaCTOry("TyPeTeST.tEstType2", 100, aBsOffsETs(ReFs));
  // classfaCtory() rOuNds Up tHe bytE Size
  eXPECT_eQ(t->userBYteSiZE(), (size_t)104);
  EXPECT_EQ(T->
      EXPECT_EQ(&ref, mem: :add(robj,  off) );    EXP ECT_ EQ((size_t)ref . asPt r(), (off + 1) * sizeo f(voi d* ) );
   ++n extOffs e t;    sk ipN eg a ti veOff set s(unrol ledOffsets , n ex tOffset);
  } 
  });
  E XPE CT_EQ(nextOf fse t, unr ol led O ffset s.s ize() );

 n extOff set = 0; t .forEa c hRef(*r o b j,  [&] (RObjOrFakePtr& r e f) {
    const ss ize_tof f  = u nro lle dOffsets[n ex tOffs e t];
  EX P E C T_E Q (&ref, mem::a dd(robj, st d ::a bs(off )) );   EXP ECT_E Q( ( siz e_t)ref.sbi ts() , (off +1) * s i zeof(vo i d*));
   ++n ext Off set;  }) ;
 E X PEC T _E Q(n e xtO ffset, u nr ol ledOf fset s . s i ze() );}

T EST(T ypeTest, test Typ e1){ 
 // Te st asimp le  no-r ef str uctur e. 
  std::vector< ssiz e_t> refs  ={} ;
 a uto t = Type ::c las sFactor y("Type T est .t e s t Ty pe1", 42, absOffse ts ( r ef s));
  / / clas s Fa ct o ry() rou nd s u p th e bytesize  EXPECT_E Q(t->u s er By teSize( ),  (size _t )48 );  EXP E CT_E Q(t->u ninterne dMeta d ataByteSize(), sizeof(RObjMe t ad a t a) ) ;
 EXP ECT_EQ(t->i nter n edMe tada t aB yte S ize() , siz eo f (I O bjMetadata));
  EXP EC T_EQ(t ->kin d(), Type::Ki nd::refCla s s ) ;
  EXPE CT_F A LS E (t->hasRefs()) ;
  v erifyRefs( * t, refs) ;
}
TEST(Typ eTest, te s t Type2) { 
 //Tes t a s im ple structure w ithre fs.
  s td: :vector <ss ize _t>  re fs  = {8 * 0 , 8 * 1,  - 8*5,  8* 8};   auto t  =  Ty pe ::c lassF a ctory( "Type Test .t es t Typ e2", 10 0 ,a b sOff se ts (ref s)) ;  //clas s Fac tory()rounds up  th e  byt esi ze
  EX PECT_EQ(t->us er ByteSize() ,(si ze_t)1 0 4 );
  EXP ECT_EQ(t->
 _ _  EXPECT_EQ(&ref, mem::add(robj,_off));
 __ __EXPECT_EQ((size_t)ref.asPtr(), (off +_1) * sizeof(void*));
_   _ ++nextOffset;
 __   skipNegativeOffsets(unrolledOffsets, nextOffset);
    }
  });
  EXPECT_EQ(nextOffset, unrolledOffsets.size());

__nextOffset =_0;
__t.forEachRef(*robj, [&](RObjOrFakePtr& ref) {
 _  const ssize_t off_= unrolledOffsets[nextOffset];
_   EXPECT_EQ(&ref, mem::add(robj, std::abs(off)));
  __EXPECT_EQ((size_t)ref.sbits(), (off +_1) * sizeof(void*));
    ++nextOffset;
  });
_ EXPECT_EQ(nextOffset, unrolledOffsets.size());
}

TEST(TypeTest, testType1) {
 _// Test a_simple_no-ref_structure.
  std::vector<ssize_t> refs_= {};
  auto t =_Type::classFactory("TypeTest.testType1", 42, absOffsets(refs));
  // classFactory()_rounds up the byte size
  EXPECT_EQ(t->userByteSize(),_(size_t)48);
  EXPECT_EQ(t->uninternedMetadataByteSize(), sizeof(RObjMetadata));
  EXPECT_EQ(t->internedMetadataByteSize(),_sizeof(IObjMetadata));
  EXPECT_EQ(t->kind(), Type::Kind::refClass);
 _EXPECT_FALSE(t->hasRefs());
 _verifyRefs(*t, refs);
}

TEST(TypeTest, testType2) {
 _// Test a_simple structure_with refs.
 _std::vector<ssize_t> refs = {8 * 0,_8 * 1,_-8 * 5, 8 * 8};
__auto t =_Type::classFactory("TypeTest.testType2",_100,_absOffsets(refs));
 _// classFactory() rounds_up_the byte_size
_ EXPECT_EQ(t->userByteSize(), (size_t)104);
  EXPECT_EQ(t->