Skip to content

Commit

Permalink
Update interface query tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Aug 23, 2021
1 parent cf956b6 commit 78252c7
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions unittest/vslib/test_sai_vs_interfacequery.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include <gtest/gtest.h>

extern "C" {
#include "sai.h"
}

#include "swss/logger.h"

TEST(libsaivs, sai_log_set)
{
EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_log_set(SAI_API_VLAN, SAI_LOG_LEVEL_NOTICE));
}

TEST(libsaivs, sai_api_query)
{
sai_vlan_api_t *api = nullptr;

EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query(SAI_API_VLAN, nullptr));
EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query(SAI_API_UNSPECIFIED, (void**)&api));

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query((sai_api_t)(1000), (void**)&api));
#pragma GCC diagnostic pop

EXPECT_EQ(SAI_STATUS_SUCCESS, sai_api_query(SAI_API_VLAN, (void**)&api));
}

TEST(libsaivs, sai_query_attribute_capability)
{
EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_query_attribute_capability(0,SAI_OBJECT_TYPE_NULL,0,0));
}

TEST(libsaivs, sai_query_attribute_enum_values_capability)
{
EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_query_attribute_enum_values_capability(0,SAI_OBJECT_TYPE_NULL,0,0));
}

TEST(libsaivs, sai_object_type_get_availability)
{
EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_object_type_get_availability(0,SAI_OBJECT_TYPE_NULL,0,0,0));
}

TEST(libsaivs, sai_dbg_generate_dump)
{
EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_dbg_generate_dump(nullptr));
}

TEST(libsaivs, sai_object_type_query)
{
EXPECT_EQ(SAI_OBJECT_TYPE_NULL, sai_object_type_query(SAI_NULL_OBJECT_ID));
}

TEST(libsaivs, sai_switch_id_query)
{
EXPECT_EQ(SAI_NULL_OBJECT_ID, sai_switch_id_query(SAI_NULL_OBJECT_ID));
}

0 comments on commit 78252c7

Please sign in to comment.