#include <limits.h>
#include <springbok.h>
#include <stdio.h>

#include "pw_unit_test/framework.h"
#include "softrvv.h"

namespace softrvv_vand_test {
namespace {

int8_t dest_e8[] = {-5, 3, 0};
int16_t dest_e16[] = {-5, 3, 0};
int32_t dest_e32[] = {-5, 3, 0};

// register value will truncate and replace vd[0]
int32_t rs1[] = {INT32_MIN, -1, 1, INT32_MAX};

const uint32_t kAVL = sizeof(dest_e8) / sizeof(dest_e8[0]);
const int32_t num_vx_tests = sizeof(rs1) / sizeof(rs1[0]);

int8_t ref_vx_e8[num_vx_tests][kAVL] = {{static_cast<int8_t>(INT32_MIN), 3, 0},
                                        {-1, 3, 0},
                                        {1, 3, 0},
                                        {static_cast<int8_t>(INT32_MAX), 3, 0}};

int16_t ref_vx_e16[num_vx_tests][kAVL] = {
    {static_cast<int16_t>(INT32_MIN), 3, 0},
    {-1, 3, 0},
    {1, 3, 0},
    {static_cast<int16_t>(INT32_MAX), 3, 0}};

int32_t ref_vx_e32[num_vx_tests][kAVL] = {
    {INT32_MIN, 3, 0}, {-1, 3, 0}, {1, 3, 0}, {INT32_MAX, 3, 0}};

class SoftRvvVmvsxTest : public ::testing::Test {
 protected:
  void SetUp() override {}
};

TEST_F(SoftRvvVmvsxTest, S_X) {
  for (int32_t i = 0; i < num_vx_tests; i++) {
    softrvv::vmv_s_x<int8_t, int32_t>(dest_e8, &rs1[i]);
    ASSERT_EQ(memcmp(dest_e8, &ref_vx_e8[i], sizeof(dest_e8)), 0);

    softrvv::vmv_s_x<int16_t, int32_t>(dest_e16, &rs1[i]);
    ASSERT_EQ(memcmp(dest_e16, &ref_vx_e16[i], sizeof(dest_e16)), 0);

    softrvv::vmv_s_x<int32_t, int32_t>(dest_e32, &rs1[i]);
    ASSERT_EQ(memcmp(dest_e32, &ref_vx_e32[i], sizeof(dest_e32)), 0);
  }
}

}  // namespace
}  // namespace softrvv_vand_test
