Skip to content

Commit cec8632

Browse files
committed
Add unit tests for Ested C6
1 parent c3d5568 commit cec8632

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

tests/test_database_content.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,37 @@ def test_quest_b6w_common_name(db_conn):
7171
assert common_name == "B6", (
7272
f"Quest B6W common_name should be 'B6', got '{common_name}'"
7373
)
74+
75+
76+
def test_estes_c6_has_two_curves_and_merged_delays(db_conn):
77+
"""
78+
The built database should contain an Estes C6 motor with merged delays from
79+
all imported ThrustCurve simfiles and two distinct thrust curves.
80+
"""
81+
cursor = db_conn.cursor()
82+
cursor.execute("""
83+
SELECT m.id, m.delays
84+
FROM motors m
85+
JOIN manufacturers mfr ON m.manufacturer_id = mfr.id
86+
WHERE (mfr.abbrev = 'Estes' OR mfr.name LIKE '%Estes%')
87+
AND m.designation = 'C6'
88+
""")
89+
rows = cursor.fetchall()
90+
91+
assert len(rows) == 1, (
92+
f"Expected exactly one Estes motor with designation 'C6', found {len(rows)}: {rows}"
93+
)
94+
95+
motor_id, delays = rows[0]
96+
assert delays == "0,3,5,7,P", (
97+
f"Estes C6 delays should be '0,3,5,7,P', got '{delays}'"
98+
)
99+
100+
cursor.execute(
101+
"SELECT COUNT(*) FROM thrust_curves WHERE motor_id = ?",
102+
(motor_id,),
103+
)
104+
curve_count = cursor.fetchone()[0]
105+
assert curve_count == 2, (
106+
f"Estes C6 should have 2 thrust curves, found {curve_count}"
107+
)

0 commit comments

Comments
 (0)