dh_unittest.cc (839B)
1 // This Source Code Form is subject to the terms of the Mozilla Public 2 // License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 // You can obtain one at http://mozilla.org/MPL/2.0/. 4 5 #include "blapi.h" 6 #include "gtest/gtest.h" 7 8 namespace nss_test { 9 10 class DHTest : public ::testing::Test { 11 protected: 12 void TestGenParamSuccess(int size) { 13 DHParams *params; 14 for (int i = 0; i < 10; i++) { 15 EXPECT_EQ(SECSuccess, DH_GenParam(size, ¶ms)); 16 PORT_FreeArena(params->arena, PR_TRUE); 17 } 18 } 19 }; 20 21 // Test parameter generation for minimum and some common key sizes 22 TEST_F(DHTest, DhGenParamSuccessTest16) { TestGenParamSuccess(16); } 23 TEST_F(DHTest, DhGenParamSuccessTest224) { TestGenParamSuccess(224); } 24 TEST_F(DHTest, DhGenParamSuccessTest256) { TestGenParamSuccess(256); } 25 26 } // namespace nss_test