Exemple #1
0
void testObj::test<2>(void)
{
  const uint8_t buf[]={4,2};
  const DataRef out  =nc_.encrypt(buf, 0);
  ensure_equals("invalid size", out.size(), 0u);
  ensure("NULL pointer returned", out.data()!=NULL);
}
Exemple #2
0
void testObj::test<5>(void)
{
  const DataRef dr1(buf_, sizeof(buf_));
  const DataRef dr2(dr1);
  ensure_equals("invalid size", dr2.size(), dr1.size());
  ensure("invalid data poitner", dr1.data()==dr2.data());
}
Exemple #3
0
void testObj::test<3>(void)
{
  const uint8_t buf[]={4,2};
  const DataRef out  =nc_.decrypt(buf, sizeof(buf));
  ensure_equals("invalid size", out.size(), 2u);
  ensure("NULL pointer returned", out.data()!=NULL);
  ensure_equals("invalid element 0", out[0], 4);
  ensure_equals("invalid element 1", out[1], 2);
}
static void PrintTo(const DataRef& dataRef,
             std::ostream*  os)
{
    *os << "Size=" << dataRef.size() << " ";
    
    for (auto d : dataRef)
    {
        *os << (int)d << " ";
    }
}
Exemple #5
0
void testObj::test<5>(void)
{
  const uint8_t *ptr=NULL;
  // some initial size
  {
    const uint8_t buf[]={4,2,6,6,6};
    const DataRef out  =nc_.decrypt(buf, sizeof(buf));
    ensure_equals("invalid size", out.size(), 5u);
    ensure("NULL pointer returned", out.data()!=NULL);
    ptr=out.data();
  }
  // no resize now
  {
    const uint8_t buf[]={4,2};
    const DataRef out  =nc_.decrypt(buf, sizeof(buf));
    ensure_equals("invalid size", out.size(), 2u);
    ensure("NULL pointer returned", out.data()!=NULL);
    ensure("pointer ha been reallocated", ptr==out.data());
  }
}
Exemple #6
0
void testObj::test<2>(void)
{
  const DataRef dr(buf_, 2);
  ensure_equals("invalid size", dr.size(), 2);
}