• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ cpputils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cpputils的典型用法代码示例。如果您正苦于以下问题:C++ cpputils类的具体用法?C++ cpputils怎么用?C++ cpputils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了cpputils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: copyTo

TEST_F(BlockStoreUtilsTest_CopyToExistingBlock, CopyDataBlock) {
  auto block = blockStore->create(Data(SIZE));
  block->write(dataFixture.data(), 0, SIZE);
  auto block2 = blockStore->create(Data(SIZE));
  copyTo(block2.get(), *block);

  EXPECT_EQ(0, std::memcmp(dataFixture.data(), block2->data(), SIZE));
}
开发者ID:HolliPolliMitHumor,项目名称:blockstore,代码行数:8,代码来源:BlockStoreUtilsTest.cpp


示例2: fillWithZeroes

TEST_F(BlockStoreUtilsTest, FillWithZeroes) {
  auto block = blockStore->create(Data(SIZE));
  block->write(dataFixture.data(), 0, SIZE);
  EXPECT_NE(0, std::memcmp(ZEROES.data(), block->data(), SIZE));
  fillWithZeroes(block.get());
  EXPECT_EQ(0, std::memcmp(ZEROES.data(), block->data(), SIZE));
}
开发者ID:HolliPolliMitHumor,项目名称:blockstore,代码行数:7,代码来源:BlockStoreUtilsTest.cpp


示例3:

TEST_F(ConcreteInnerEncryptorTest, DoesntDecryptWithWrongCipherName) {
    auto encryptor = makeInnerEncryptor<Twofish128_CFB>();
    InnerConfig encrypted = encryptor->encrypt(Data(0));
    encrypted.cipherName = AES256_CFB::NAME;
    auto decrypted = encryptor->decrypt(encrypted);
    EXPECT_EQ(none, decrypted);
}
开发者ID:syrix,项目名称:cryfs,代码行数:7,代码来源:ConcreteInnerEncryptorTest.cpp


示例4: copyToNewBlock

TEST_F(BlockStoreUtilsTest_CopyToNewBlock, OriginalBlockUnchanged) {
  auto block = blockStore->create(Data(SIZE));
  block->write(dataFixture.data(), 0, SIZE);
  auto block2 = copyToNewBlock(blockStore.get(), *block);

  EXPECT_EQ(SIZE, block->size());
  EXPECT_EQ(0, std::memcmp(dataFixture.data(), block->data(), SIZE));
}
开发者ID:HolliPolliMitHumor,项目名称:blockstore,代码行数:8,代码来源:BlockStoreUtilsTest.cpp


示例5: Data

TEST_F(OnDiskBlockCreateTest, CreatingBlockCreatesFile) {
  EXPECT_FALSE(bf::exists(file.path()));

  auto block = OnDiskBlock::CreateOnDisk(dir.path(), key, Data(0));

  EXPECT_TRUE(bf::exists(file.path()));
  EXPECT_TRUE(bf::is_regular_file(file.path()));
}
开发者ID:HolliPolliMitHumor,项目名称:blockstore,代码行数:8,代码来源:OnDiskBlockCreateTest.cpp


示例6:

TEST_F(CryConfigEncryptorFactoryTest, DoesntDecryptWithWrongPassword_EmptyData) {
    auto encryptor = CryConfigEncryptorFactory::deriveKey("mypassword", SCrypt::TestSettings);
    Data encrypted = encryptor->encrypt(Data(0), AES256_GCM::NAME);

    auto loadedEncryptor = CryConfigEncryptorFactory::loadKey(encrypted, "wrongpassword").value();
    auto decrypted = loadedEncryptor->decrypt(encrypted);
    EXPECT_EQ(none, decrypted);
}
开发者ID:Gitborter,项目名称:cryfs,代码行数:8,代码来源:CryConfigEncryptorFactoryTest.cpp


示例7: makeEncryptor

TEST_F(CryConfigEncryptorTest, EncryptionIsFixedSize) {
    auto encryptor = makeEncryptor();
    Data encrypted1 = encryptor->encrypt(DataFixture::generate(100), AES128_CFB::NAME);
    Data encrypted2 = encryptor->encrypt(DataFixture::generate(200), Twofish256_GCM::NAME);
    Data encrypted3 = encryptor->encrypt(Data(0), AES256_GCM::NAME);

    EXPECT_EQ(encrypted1.size(), encrypted2.size());
    EXPECT_EQ(encrypted1.size(), encrypted3.size());
}
开发者ID:syrix,项目名称:cryfs,代码行数:9,代码来源:CryConfigEncryptorTest.cpp


示例8:

TEST_F(CachingBlockStoreTest, PhysicalBlockSize_negativeboundaries) {
    // This tests that a potential if/else in blockSizeFromPhysicalBlockSize that catches negative values has the
    // correct boundary set. We test the highest value that is negative and the smallest value that is positive.
    auto physicalSizeForVirtualSizeZero = baseBlockStore->load(CreateBlockReturnKey(Data(0))).value()->size();
    if (physicalSizeForVirtualSizeZero > 0) {
        EXPECT_EQ(0u, blockStore.blockSizeFromPhysicalBlockSize(physicalSizeForVirtualSizeZero - 1));
    }
    EXPECT_EQ(0u, blockStore.blockSizeFromPhysicalBlockSize(physicalSizeForVirtualSizeZero));
    EXPECT_EQ(1u, blockStore.blockSizeFromPhysicalBlockSize(physicalSizeForVirtualSizeZero + 1));
}
开发者ID:Gitborter,项目名称:cryfs,代码行数:10,代码来源:CachingBlockStoreTest_Specific.cpp


示例9: CreateBlockReturnKey

TEST_F(CachingBlockStoreTest, PhysicalBlockSize_zerovirtual) {
    auto key = CreateBlockReturnKey(Data(0));
    auto base = baseBlockStore->load(key).value();
    EXPECT_EQ(0u, blockStore.blockSizeFromPhysicalBlockSize(base->size()));
}
开发者ID:Gitborter,项目名称:cryfs,代码行数:5,代码来源:CachingBlockStoreTest_Specific.cpp


示例10: DerivedKeyConfig

 DerivedKey<CryConfigEncryptor::MaxTotalKeySize> _derivedKey() {
     auto salt = DataFixture::generate(128, 2);
     auto keyConfig = DerivedKeyConfig(std::move(salt), 1024, 1, 2);
     auto key = DataFixture::generateFixedSize<CryConfigEncryptor::MaxTotalKeySize>(3);
     return DerivedKey<CryConfigEncryptor::MaxTotalKeySize>(std::move(keyConfig), std::move(key));
 }
开发者ID:syrix,项目名称:cryfs,代码行数:6,代码来源:CryConfigEncryptorTest.cpp


示例11: OnDiskBlockCreateSizeTest

 OnDiskBlockCreateSizeTest():
   block(OnDiskBlock::CreateOnDisk(dir.path(), key, std::move(Data(GetParam()).FillWithZeroes())).value()),
   ZEROES(block->size())
 {
   ZEROES.FillWithZeroes();
 }
开发者ID:HolliPolliMitHumor,项目名称:blockstore,代码行数:6,代码来源:OnDiskBlockCreateTest.cpp


示例12: CreateBlockWriteFixtureToItAndReturnKey

 blockstore::Key CreateBlockWriteFixtureToItAndReturnKey() {
   auto block = blockStore->create(Data(data.size()));
   block->write(data.data(), 0, data.size());
   return block->key();
 }
开发者ID:Gitborter,项目名称:cryfs,代码行数:5,代码来源:EncryptedBlockStoreTest_Specific.cpp


示例13:

TEST_F(OuterConfigTest, SomeValues) {
    Data serialized = OuterConfig{DerivedKeyConfig(salt(), N, r, p), DataFixture::generate(1024)}.serialize();
    OuterConfig deserialized = OuterConfig::deserialize(serialized).value();
    EXPECT_EQ(DerivedKeyConfig(salt(), N, r, p), deserialized.keyConfig);
    EXPECT_EQ(DataFixture::generate(1024), deserialized.encryptedInnerConfig);
}
开发者ID:kjdyck,项目名称:cryfs,代码行数:6,代码来源:OuterConfigTest.cpp


示例14: Data

TEST_F(OuterConfigTest, DataAndKeyConfigEmpty) {
    Data serialized = OuterConfig{DerivedKeyConfig(Data(0), 0, 0, 0), Data(0)}.serialize();
    OuterConfig deserialized = OuterConfig::deserialize(serialized).value();
    EXPECT_EQ(DerivedKeyConfig(Data(0), 0, 0, 0), deserialized.keyConfig);
    EXPECT_EQ(Data(0), deserialized.encryptedInnerConfig);
}
开发者ID:kjdyck,项目名称:cryfs,代码行数:6,代码来源:OuterConfigTest.cpp


示例15: Data

TEST_F(OuterConfigTest, DataAndKeyConfigEmpty) {
    Data serialized = OuterConfig{Data(0), Data(0), false}.serialize();
    OuterConfig deserialized = OuterConfig::deserialize(serialized).value();
    EXPECT_EQ(Data(0), deserialized.kdfParameters);
    EXPECT_EQ(Data(0), deserialized.encryptedInnerConfig);
}
开发者ID:Gitborter,项目名称:cryfs,代码行数:6,代码来源:OuterConfigTest.cpp



注:本文中的cpputils类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ csArray类代码示例发布时间:2022-05-31
下一篇:
C++ cpp_int_backend类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap