示例#1
0
TEST(TypesTests, VectorDistance) {
    float2 f2_1(1.0f, -2.0f);
    float2 f2_2(4.0f, 1.0f);
    EXPECT_FLOAT_EQ(0.0, f2_1.distance(f2_1));
    EXPECT_FLOAT_EQ(4.242640687, f2_1.distance(f2_2));
    EXPECT_FLOAT_EQ(4.242640687, f2_2.distance(f2_1));

    float3 f3_1(1.0f, 0.5f, -1.0f);
    float3 f3_2(2.0f, 1.0f, -1.0f);
    EXPECT_FLOAT_EQ(0.0, f3_1.distance(f3_1));
    EXPECT_FLOAT_EQ(1.118033989,f3_1.distance(f3_2));
    EXPECT_FLOAT_EQ(1.118033989,f3_2.distance(f3_1));

    int2 i2_1(1,-2);
    int2 i2_2(4,1);
    EXPECT_FLOAT_EQ(0.0, i2_1.distance(i2_1));
    EXPECT_FLOAT_EQ(4.242640687, i2_1.distance(i2_2));
    EXPECT_FLOAT_EQ(4.242640687, i2_2.distance(i2_1));

    int3 i3_1(1,0,-1);
    int3 i3_2(2,1,1);
    EXPECT_FLOAT_EQ(0.0f, i3_1.distance(i3_1));
    EXPECT_FLOAT_EQ(2.449489743, i3_1.distance(i3_2));
    EXPECT_FLOAT_EQ(2.449489743, i3_2.distance(i3_1));

    EXPECT_FLOAT_EQ(0.0,f2_1.distance(i2_1));
    EXPECT_FLOAT_EQ(0.0,i2_1.distance(f2_1));

    EXPECT_FLOAT_EQ(0.5,f3_1.distance(i3_1));
    EXPECT_FLOAT_EQ(0.5,i3_1.distance(f3_1));
}
示例#2
0
TEST(TypesTests, Equal) {
    float2 f2_1(1.0f, -2.0f);
    float2 f2_2(4.0f, 1.0f);
    EXPECT_TRUE(f2_1 == f2_1);
    EXPECT_FALSE(f2_1 == f2_2);

    float3 f3_1(1.0f, 0.5f, -1.0f);
    float3 f3_2(2.0f, 1.0f, -1.0f);
    EXPECT_TRUE(f3_1 == f3_1);
    EXPECT_FALSE(f3_1 == f3_2);

    int2 i2_1(1,-2);
    int2 i2_2(4,1);
    EXPECT_TRUE(i2_1 == i2_1);
    EXPECT_FALSE(i2_1 == i2_2);

    int3 i3_1(1,0,-1);
    int3 i3_2(2,1,-1);
    EXPECT_TRUE(i3_1 == i3_1);
    EXPECT_FALSE(i3_1 == i3_2);

    EXPECT_TRUE(f2_1 == i2_1);
    EXPECT_FALSE(f2_1 == i2_2);

    EXPECT_TRUE(f3_2 == i3_2);
    EXPECT_FALSE(f3_1 == i3_1);
}
示例#3
0
TEST(TypesTests, DotProduct) {
    float2 f2_1(1.0f, -2.0f);
    float2 f2_2(4.0f, 1.0f);
    EXPECT_FLOAT_EQ(2.0f,f2_1.dot(f2_2));
    EXPECT_FLOAT_EQ(2.0f,f2_2.dot(f2_1));

    float3 f3_1(1.0f, 0.5f, -1.0f);
    float3 f3_2(2.0f, 1.0f, -1.0f);
    EXPECT_FLOAT_EQ(3.5f, f3_1.dot(f3_2));
    EXPECT_FLOAT_EQ(3.5f, f3_2.dot(f3_1));

    int2 i2_1(1,-2);
    int2 i2_2(4,1);
    EXPECT_FLOAT_EQ(2.0f, i2_1.dot(i2_2));
    EXPECT_FLOAT_EQ(2.0f, i2_2.dot(i2_1));

    int3 i3_1(1,0,-1);
    int3 i3_2(2,1,-1);
    EXPECT_FLOAT_EQ(3.0f, i3_1.dot(i3_2));
    EXPECT_FLOAT_EQ(3.0f, i3_2.dot(i3_1));

    EXPECT_FLOAT_EQ(2.0f,f2_1.dot(i2_2));
    EXPECT_FLOAT_EQ(2.0f,i2_2.dot(f2_1));

    EXPECT_FLOAT_EQ(3.5f,f3_1.dot(i3_2));
    EXPECT_FLOAT_EQ(3.5f,i3_2.dot(f3_1));
}
示例#4
0
TEST(TypesTests, VectorVectorArithmetic) {
    float2 f2_1(1.1f, -2.0f);
    float2 f2_2(4.0f, 1.0f);
    float2 f2_3;
    f2_3 = f2_1+f2_2;
    EXPECT_FLOAT_EQ(5.1f, f2_3.x);
    EXPECT_FLOAT_EQ(-1.0f, f2_3.y);
    f2_3 = f2_2+f2_1;
    EXPECT_FLOAT_EQ(5.1f, f2_3.x);
    EXPECT_FLOAT_EQ(-1.0f, f2_3.y);

    f2_3 = f2_1-f2_2;
    EXPECT_FLOAT_EQ(-2.9f, f2_3.x);
    EXPECT_FLOAT_EQ(-3.0f, f2_3.y);
    f2_3 = f2_2-f2_1;
    EXPECT_FLOAT_EQ(2.9f, f2_3.x);
    EXPECT_FLOAT_EQ(3.0f, f2_3.y);

    f2_3 = f2_1*f2_2;
    EXPECT_FLOAT_EQ(4.4f, f2_3.x);
    EXPECT_FLOAT_EQ(-2.0f, f2_3.y);
    f2_3 = f2_2*f2_1;
    EXPECT_FLOAT_EQ(4.4f, f2_3.x);
    EXPECT_FLOAT_EQ(-2.0f, f2_3.y);


    float3 f3_1(1.0f, -0.5f, -1.0f);
    float3 f3_2(2.0f, 1.0f, -1.0f);
    float3 f3_3;
    f3_3 = f3_1+f3_2;
    EXPECT_FLOAT_EQ(3.0f, f3_3.x);
    EXPECT_FLOAT_EQ(0.5f, f3_3.y);
    EXPECT_FLOAT_EQ(-2.0f, f3_3.z);
    f3_3 = f3_2+f3_1;
    EXPECT_FLOAT_EQ(3.0f, f3_3.x);
    EXPECT_FLOAT_EQ(0.5f, f3_3.y);
    EXPECT_FLOAT_EQ(-2.0f, f3_3.z);

    f3_3 = f3_1-f3_2;
    EXPECT_FLOAT_EQ(-1.0f, f3_3.x);
    EXPECT_FLOAT_EQ(-1.5f, f3_3.y);
    EXPECT_FLOAT_EQ(0.0f, f3_3.z);
    f3_3 = f3_2-f3_1;
    EXPECT_FLOAT_EQ(1.0f, f3_3.x);
    EXPECT_FLOAT_EQ(1.5f, f3_3.y);
    EXPECT_FLOAT_EQ(0.0f, f3_3.z);

    f3_3 = f3_1*f3_2;
    EXPECT_FLOAT_EQ(2.0f, f3_3.x);
    EXPECT_FLOAT_EQ(-0.5f, f3_3.y);
    EXPECT_FLOAT_EQ(1.0f, f3_3.z);
    f3_3 = f3_2*f3_1;
    EXPECT_FLOAT_EQ(2.0f, f3_3.x);
    EXPECT_FLOAT_EQ(-0.5f, f3_3.y);
    EXPECT_FLOAT_EQ(1.0f, f3_3.z);

    // TODO add int2 and int3 tests as well
}
EpcS1uDlTestSuite::EpcS1uDlTestSuite ()
  : TestSuite ("epc-s1u-downlink", SYSTEM)
{  
  std::vector<EnbDlTestData> v1;  
  EnbDlTestData e1;
  UeDlTestData f1 (1, 100);
  e1.ues.push_back (f1);
  v1.push_back (e1);
  AddTestCase (new EpcS1uDlTestCase ("1 eNB, 1UE", v1), TestCase::QUICK);


  std::vector<EnbDlTestData> v2;  
  EnbDlTestData e2;
  UeDlTestData f2_1 (1, 100);
  e2.ues.push_back (f2_1);
  UeDlTestData f2_2 (2, 200);
  e2.ues.push_back (f2_2);
  v2.push_back (e2);
  AddTestCase (new EpcS1uDlTestCase ("1 eNB, 2UEs", v2), TestCase::QUICK);


  std::vector<EnbDlTestData> v3;  
  v3.push_back (e1);
  v3.push_back (e2);
  AddTestCase (new EpcS1uDlTestCase ("2 eNBs", v3), TestCase::QUICK);


  EnbDlTestData e3;
  UeDlTestData f3_1 (3, 50);
  e3.ues.push_back (f3_1);
  UeDlTestData f3_2 (5, 1472);
  e3.ues.push_back (f3_2);
  UeDlTestData f3_3 (1, 1);
  e3.ues.push_back (f3_2);
  std::vector<EnbDlTestData> v4;  
  v4.push_back (e3);
  v4.push_back (e1);
  v4.push_back (e2);
  AddTestCase (new EpcS1uDlTestCase ("3 eNBs", v4), TestCase::QUICK);

  std::vector<EnbDlTestData> v5;  
  EnbDlTestData e5;
  UeDlTestData f5 (10, 3000);
  e5.ues.push_back (f5);
  v5.push_back (e5);
  AddTestCase (new EpcS1uDlTestCase ("1 eNB, 10 pkts 3000 bytes each", v5), TestCase::QUICK);

  std::vector<EnbDlTestData> v6;  
  EnbDlTestData e6;
  UeDlTestData f6 (50, 3000);
  e6.ues.push_back (f6);
  v6.push_back (e6);
  AddTestCase (new EpcS1uDlTestCase ("1 eNB, 50 pkts 3000 bytes each", v6), TestCase::QUICK);
  
  std::vector<EnbDlTestData> v7;  
  EnbDlTestData e7;
  UeDlTestData f7 (10, 15000);
  e7.ues.push_back (f7);
  v7.push_back (e7);
  AddTestCase (new EpcS1uDlTestCase ("1 eNB, 10 pkts 15000 bytes each", v7), TestCase::QUICK);

  std::vector<EnbDlTestData> v8;  
  EnbDlTestData e8;
  UeDlTestData f8 (100, 15000);
  e8.ues.push_back (f8);
  v8.push_back (e8);
  AddTestCase (new EpcS1uDlTestCase ("1 eNB, 100 pkts 15000 bytes each", v8), TestCase::QUICK);
}