TEST_F(HostapdManagerTest, GeneratesCorrectWpa2Config) {
  string config = GetConfigForEncryptionType(
      HostapdManager::EncryptionType::kWpa2);
  VerifyCommonConfigs(config);
  EXPECT_THAT(config, HasSubstr("wpa=2\n"));
  EXPECT_THAT(config, HasSubstr("rsn_pairwise=CCMP\n"));
  EXPECT_THAT(config, HasSubstr(kConfigPskLine));
}
TEST_F(HostapdManagerTest, CorrectlyInfersHwMode) {
  string config = HostapdManager().CreateHostapdConfig(
        kTestInterfaceName,
        cstr2vector(kTestSsidStr),
        true,
        44,
        HostapdManager::EncryptionType::kOpen,
        vector<uint8_t>());
  EXPECT_THAT(config, HasSubstr("hw_mode=a\n"));
  EXPECT_THAT(config, Not(HasSubstr("hw_mode=g\n")));
}
TEST_F(HostapdManagerTest, RespectsHiddenSetting) {
  string config = HostapdManager().CreateHostapdConfig(
        kTestInterfaceName,
        cstr2vector(kTestSsidStr),
        true,
        kTestChannel,
        HostapdManager::EncryptionType::kOpen,
        vector<uint8_t>());
  EXPECT_THAT(config, HasSubstr("ignore_broadcast_ssid=1\n"));
  EXPECT_THAT(config, Not(HasSubstr("ignore_broadcast_ssid=0\n")));
}
예제 #4
0
TEST_P(GeneratorStringTest, Sample) {
  auto words = CompileSuccessfully("");
  EXPECT_EQ(2u, SPV_INDEX_GENERATOR_NUMBER);
  words[SPV_INDEX_GENERATOR_NUMBER] =
      SPV_GENERATOR_WORD(GetParam().generator, GetParam().misc);

  spv_text decoded_text = nullptr;
  EXPECT_THAT(spvBinaryToText(ScopedContext().context, words.data(),
                              words.size(), SPV_BINARY_TO_TEXT_OPTION_NONE,
                              &decoded_text, &diagnostic),
              Eq(SPV_SUCCESS));
  EXPECT_THAT(diagnostic, Eq(nullptr));
  EXPECT_THAT(std::string(decoded_text->str), HasSubstr(GetParam().expected));
  spvTextDestroy(decoded_text);
}
예제 #5
0
TEST_F( JavaScriptExecuterTest, creating_invalid_attribute_ZCL_uint16) {
	ZEndpoint zEndpoint { NWK_ADDRESS, ENDPOINT_ID, PROFILE_ID, DEVICE_ID, DEVICE_VER, IN_CLUSTERS, OUT_CLUSTERS };
	ZDevice zDevice { extAddress, NWK_ADDRESS, 0, { zEndpoint } };
	Log log;
	std::stringstream js;
	jsExecuter = make_shared<JavaScriptExecuter>(singletonObjects, log);
	EXPECT_CALL(*zDevices, exists(extAddress)).WillOnce(Return(true));
	EXPECT_CALL(*zDevices, getDevice(extAddress)).WillOnce(Return(&zDevice));
	string objectName = "Z" + ZCL_uint16_Attribute::name();

	js << objectName << "('" << EXTENDED_ADDRESS << "', " << ENDPOINT_ID << ", " << BASIC_CLUSTER << "," << APPLICATION_VERSION_ID << ");";

	jsExecuter->run(js.str());
	jsExecuter->join();

	ASSERT_FALSE(log.empty());
	Log::LogData logData = log.get();
	ASSERT_THAT(logData.level, Log::ERROR);
	ASSERT_THAT(logData.msg, HasSubstr("Unable to create an instance of " + objectName));

	jsExecuter.reset();
}
예제 #6
0
// Number of bits in a float may be only one of: {16,32,64}
TEST_F(ValidateData, float_invalid_num_bits) {
  std::string str = header + "%2 = OpTypeFloat 48";
  CompileSuccessfully(str.c_str());
  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
  EXPECT_THAT(getDiagnosticString(), HasSubstr(invalid_num_bits_error));
}
예제 #7
0
TEST_F(ValidateData, float64_bad) {
  std::string str = header + "%2 = OpTypeFloat 64";
  CompileSuccessfully(str.c_str());
  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
  EXPECT_THAT(getDiagnosticString(), HasSubstr(missing_float64_cap_error));
}