-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbiod_crypto_test.cc
35 lines (27 loc) · 1.05 KB
/
biod_crypto_test.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2019 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <vector>
#include <gtest/gtest.h>
#include "biod/biod_crypto.h"
#include "biod/biod_crypto_test_data.h"
namespace biod {
namespace {
using crypto_test_data::kFakePositiveMatchSecret1;
using crypto_test_data::kFakeValidationValue1;
using crypto_test_data::kUserID;
TEST(BiodCryptoTest, ComputeValidationValue) {
std::vector<uint8_t> result;
EXPECT_TRUE(BiodCrypto::ComputeValidationValue(kFakePositiveMatchSecret1,
kUserID, &result));
EXPECT_EQ(result, kFakeValidationValue1);
}
TEST(BiodCryptoTest, ComputeValidationValue_InvalidUserId) {
std::string invalid_user_id = "nothex";
std::vector<uint8_t> result;
EXPECT_FALSE(BiodCrypto::ComputeValidationValue(kFakePositiveMatchSecret1,
invalid_user_id, &result));
EXPECT_TRUE(result.empty());
}
} // namespace
} // namespace biod