From 494c30fad054186270d057cd48bc60fc675bdbe4 Mon Sep 17 00:00:00 2001 From: Arthur Golubtsov Date: Sat, 30 May 2020 21:38:08 +0300 Subject: [PATCH] Update tests --- tests/animation_4.csv | 161 ++++++++++++++++++++++++++++++++++++++++ tests/animation_test.py | 21 +++++- 2 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 tests/animation_4.csv diff --git a/tests/animation_4.csv b/tests/animation_4.csv new file mode 100644 index 0000000..530caf5 --- /dev/null +++ b/tests/animation_4.csv @@ -0,0 +1,161 @@ +two_drones_test +1,0.2,1.4,1.0,0.15708,0,0,0 +2,0.2,1.4,1.0,0.15708,0,0,0 +3,0.2,1.4,1.0,0.15708,0,0,0 +4,0.2,1.4,1.0,0.15708,0,0,0 +5,0.2,1.4,1.0,0.15708,0,0,0 +6,0.2,1.4,1.0,0.15708,0,0,0 +7,0.2,1.4,1.0,0.15708,0,0,0 +8,0.2,1.4,1.0,0.15708,0,0,0 +9,0.2,1.4,1.0,0.15708,0,0,0 +10,0.2,1.4,1.0,0.15708,0,0,0 +11,0.20441,1.4,1.0,0.15708,0,0,0 +12,0.21774,1.4,1.0,0.15708,0,0,0 +13,0.24002,1.4,1.0,0.15708,0,0,0 +14,0.27111,1.4,1.0,0.15708,0,0,0 +15,0.31063,1.4,1.0,0.15708,0,0,0 +16,0.3579,1.4,1.0,0.15708,0,0,0 +17,0.41193,1.4,1.0,0.15708,0,0,0 +18,0.47141,1.4,1.0,0.15708,0,0,0 +19,0.53472,1.4,1.0,0.15708,0,0,0 +20,0.6,1.4,1.0,0.15708,0,0,0 +21,0.66528,1.4,1.0,0.15708,0,0,0 +22,0.72859,1.4,1.0,0.15708,0,0,0 +23,0.78807,1.4,1.0,0.15708,0,0,0 +24,0.8421,1.4,1.0,0.15708,0,0,0 +25,0.88937,1.4,1.0,0.15708,0,0,0 +26,0.92889,1.4,1.0,0.15708,0,0,0 +27,0.95998,1.4,1.0,0.15708,0,0,0 +28,0.98226,1.4,1.0,0.15708,0,0,0 +29,0.99559,1.4,1.0,0.15708,0,0,0 +30,1.0,1.4,1.0,0.15708,0,0,0 +31,1.0,1.40441,1.0,0.15708,0,0,0 +32,1.0,1.41774,1.0,0.15708,0,0,0 +33,1.0,1.44002,1.0,0.15708,0,0,0 +34,1.0,1.47111,1.0,0.15708,0,0,0 +35,1.0,1.51063,1.0,0.15708,0,0,0 +36,1.0,1.5579,1.0,0.15708,0,0,0 +37,1.0,1.61193,1.0,0.15708,0,0,0 +38,1.0,1.67141,1.0,0.15708,0,0,0 +39,1.0,1.73472,1.0,0.15708,0,0,0 +40,1.0,1.8,1.0,0.15708,0,0,0 +41,1.0,1.86528,1.0,0.15708,0,0,0 +42,1.0,1.92859,1.0,0.15708,0,0,0 +43,1.0,1.98807,1.0,0.15708,0,0,0 +44,1.0,2.0421,1.0,0.15708,0,0,0 +45,1.0,2.08937,1.0,0.15708,0,0,0 +46,1.0,2.12889,1.0,0.15708,0,0,0 +47,1.0,2.15998,1.0,0.15708,0,0,0 +48,1.0,2.18226,1.0,0.15708,0,0,0 +49,1.0,2.19559,1.0,0.15708,0,0,0 +50,1.0,2.2,1.0,0.15708,0,0,0 +51,0.99559,2.2,1.0,0.15708,0,0,0 +52,0.98226,2.2,1.0,0.15708,0,0,0 +53,0.95998,2.2,1.0,0.15708,0,0,0 +54,0.92889,2.2,1.0,0.15708,0,0,0 +55,0.88937,2.2,1.0,0.15708,0,0,0 +56,0.8421,2.2,1.0,0.15708,0,0,0 +57,0.78807,2.2,1.0,0.15708,0,0,0 +58,0.72859,2.2,1.0,0.15708,0,0,0 +59,0.66528,2.2,1.0,0.15708,0,0,0 +60,0.6,2.2,1.0,0.15708,0,0,0 +61,0.53472,2.2,1.0,0.15708,0,0,0 +62,0.47141,2.2,1.0,0.15708,0,0,0 +63,0.41193,2.2,1.0,0.15708,0,0,0 +64,0.3579,2.2,1.0,0.15708,0,0,0 +65,0.31063,2.2,1.0,0.15708,0,0,0 +66,0.27111,2.2,1.0,0.15708,0,0,0 +67,0.24002,2.2,1.0,0.15708,0,0,0 +68,0.21774,2.2,1.0,0.15708,0,0,0 +69,0.20441,2.2,1.0,0.15708,0,0,0 +70,0.2,2.2,1.0,0.15708,0,0,0 +71,0.2,2.19559,1.0,0.15708,0,0,0 +72,0.2,2.18226,1.0,0.15708,0,0,0 +73,0.2,2.15998,1.0,0.15708,0,0,0 +74,0.2,2.12889,1.0,0.15708,0,0,0 +75,0.2,2.08937,1.0,0.15708,0,0,0 +76,0.2,2.0421,1.0,0.15708,0,0,0 +77,0.2,1.98807,1.0,0.15708,0,0,0 +78,0.2,1.92859,1.0,0.15708,0,0,0 +79,0.2,1.86528,1.0,0.15708,0,0,0 +80,0.2,1.8,1.0,0.15708,0,0,0 +81,0.2,1.73472,1.0,0.15708,0,0,0 +82,0.2,1.67141,1.0,0.15708,0,0,0 +83,0.2,1.61193,1.0,0.15708,0,0,0 +84,0.2,1.5579,1.0,0.15708,0,0,0 +85,0.2,1.51063,1.0,0.15708,0,0,0 +86,0.2,1.47111,1.0,0.15708,0,0,0 +87,0.2,1.44002,1.0,0.15708,0,0,0 +88,0.2,1.41774,1.0,0.15708,0,0,0 +89,0.2,1.40441,1.0,0.15708,0,0,0 +90,0.2,1.4,1.0,0.15708,0,0,0 +91,0.2062,1.4,1.0,0.15708,0,0,0 +92,0.22355,1.4,1.0,0.15708,0,0,0 +93,0.25043,1.4,1.0,0.15708,0,0,0 +94,0.28553,1.4,1.0,0.15708,0,0,0 +95,0.32771,1.4,1.0,0.15708,0,0,0 +96,0.3759,1.4,1.0,0.15708,0,0,0 +97,0.42903,1.4,1.0,0.15708,0,0,0 +98,0.48579,1.4,1.0,0.15708,0,0,0 +99,0.54421,1.4,1.0,0.15708,0,0,0 +100,0.6,1.4,1.0,0.15708,0,0,0 +101,0.66257,1.40492,1.025,0.15708,0,0,0 +102,0.72361,1.41958,1.05,0.31416,0,0,0 +103,0.7816,1.4436,1.075,0.47124,0,0,0 +104,0.83511,1.47639,1.1,0.62832,0,0,0 +105,0.88284,1.51716,1.125,0.7854,0,0,0 +106,0.92361,1.56489,1.15,0.94248,0,0,0 +107,0.9564,1.6184,1.175,1.09956,0,0,0 +108,0.98042,1.67639,1.2,1.25664,0,0,0 +109,0.99508,1.73743,1.225,1.41372,0,0,0 +110,1.0,1.8,1.25,1.5708,0,0,0 +111,0.99508,1.86257,1.275,1.72788,0,0,0 +112,0.98042,1.92361,1.3,1.88496,0,0,0 +113,0.9564,1.9816,1.325,2.04204,0,0,0 +114,0.92361,2.03511,1.35,2.19912,0,0,0 +115,0.88284,2.08284,1.375,2.35619,0,0,0 +116,0.83511,2.12361,1.4,2.51327,0,0,0 +117,0.7816,2.1564,1.425,2.67035,0,0,0 +118,0.72361,2.18042,1.45,2.82743,0,0,0 +119,0.66257,2.19508,1.475,2.98451,0,0,0 +120,0.6,2.2,1.5,-3.14159,0,0,0 +121,0.53743,2.19508,1.525,-2.98451,0,0,0 +122,0.47639,2.18042,1.55,-2.82743,0,0,0 +123,0.4184,2.1564,1.575,-2.67035,0,0,0 +124,0.36489,2.12361,1.6,-2.51327,0,0,0 +125,0.31716,2.08284,1.625,-2.35619,0,0,0 +126,0.27639,2.03511,1.65,-2.19911,0,0,0 +127,0.2436,1.9816,1.675,-2.04203,0,0,0 +128,0.21958,1.92361,1.7,-1.88495,0,0,0 +129,0.20492,1.86257,1.725,-1.72788,0,0,0 +130,0.2,1.8,1.75,-1.5708,0,0,0 +131,0.20492,1.73743,1.775,-1.41372,0,0,0 +132,0.21958,1.67639,1.8,-1.25664,0,0,0 +133,0.2436,1.6184,1.825,-1.09956,0,0,0 +134,0.27639,1.56489,1.85,-0.94248,0,0,0 +135,0.31716,1.51716,1.875,-0.7854,0,0,0 +136,0.36489,1.47639,1.9,-0.62832,0,0,0 +137,0.4184,1.4436,1.925,-0.47124,0,0,0 +138,0.47639,1.41958,1.95,-0.31416,0,0,0 +139,0.53743,1.40492,1.975,-0.15708,0,0,0 +140,0.6,1.4,2.0,0.0,0,0,0 +141,0.6,1.4,2.0,0.0,0,0,0 +142,0.6,1.4,2.0,0.0,0,0,0 +143,0.6,1.4,2.0,0.0,0,0,0 +144,0.6,1.4,2.0,0.0,0,0,0 +145,0.6,1.4,2.0,0.0,0,0,0 +146,0.6,1.4,2.0,0.0,0,0,0 +147,0.6,1.4,2.0,0.0,0,0,0 +148,0.6,1.4,2.0,0.0,0,0,0 +149,0.6,1.4,2.0,0.0,0,0,0 +150,0.6,1.4,2.0,0.0,0,0,0 +151,0.6,1.4,2.0,0.0,0,0,0 +152,0.6,1.4,2.0,0.0,0,0,0 +153,0.6,1.4,2.0,0.0,0,0,0 +154,0.6,1.4,2.0,0.0,0,0,0 +155,0.6,1.4,2.0,0.0,0,0,0 +156,0.6,1.4,2.0,0.0,0,0,0 +157,0.6,1.4,2.0,0.0,0,0,0 +158,0.6,1.4,2.0,0.0,0,0,0 +159,0.6,1.4,2.0,0.0,0,0,0 +160,0.6,1.4,2.0,0.0,0,0,0 diff --git a/tests/animation_test.py b/tests/animation_test.py index 5fde3b8..ce0abd7 100644 --- a/tests/animation_test.py +++ b/tests/animation_test.py @@ -75,7 +75,7 @@ def test_animation_2(): def test_animation_3(): a.update_frames(config, "animation_3.csv") assert a.id == 'route' - assert a.original_frames[9].get_pos() == [0.97783,0.0,1.0] + assert approx(a.original_frames[9].get_pos()) == [0.97783,0.0,1.0] assert a.original_frames[9].get_color() == [0,204,2] assert a.original_frames[9].pose_is_valid() assert animation_lib.get_numbers(a.static_begin_frames) == [] @@ -90,6 +90,25 @@ def test_animation_3(): assert approx(a.get_scaled_output_min_z(ratio=[1,2,3], offset=[4,5,6])) == 9 assert approx(a.get_start_point(ratio=[1,2,3], offset=[4,5,6])) == [4,5,9] +def test_animation_4(): + a.update_frames(config, "animation_4.csv") + assert a.id == 'two_drones_test' + assert approx(a.original_frames[11].get_pos()) == [0.21774,1.4,1.0] + assert a.original_frames[11].get_color() == [0,0,0] + assert a.original_frames[11].pose_is_valid() + assert animation_lib.get_numbers(a.static_begin_frames) == range(1,12) + assert animation_lib.get_numbers(a.takeoff_frames) == [] + assert animation_lib.get_numbers(a.route_frames) == range(12,141) + assert animation_lib.get_numbers(a.land_frames) == [] + assert animation_lib.get_numbers(a.static_end_frames) == range(141,161) + assert animation_lib.get_numbers(a.output_frames) == range(12,141) + assert approx(a.static_begin_time) == 1.1 + assert approx(a.takeoff_time) == 0 + assert approx(a.output_frames_min_z) == 1 + assert approx(a.get_scaled_output(ratio=[1,2,3], offset=[4,5,6])[0].get_pos()) == [4.21774,7.8,9] + assert approx(a.get_scaled_output_min_z(ratio=[1,2,3], offset=[4,5,6])) == 9 + assert approx(a.get_start_point(ratio=[1,2,3], offset=[4,5,6])) == [4.21774,7.8,9] + def test_animation_no_file(): a.update_frames(config, "zzz.csv") assert a.id == None