Commit cac2af6
Benjamin Moody
SignalMixin.wr_dats: acknowledge that optional fields aren't checked.
The original intention of this code was that get_write_fields would
return a list of signal information fields to be saved, and
check_sig_cohesion would check that those specified fields matched the
actual signal data.
However, this did not do what was intended.
HeaderMixin.get_write_fields returns a 2-tuple of (rec_write_fields,
sig_write_fields), not a list of field names. Therefore, the
parameter to check_sig_cohesion never had "checksum" or "init_value"
as elements, and therefore, check_sig_cohesion never actually checked
the values of these fields when writing a record.
Many existing test cases rely on being able to read and write a record
as-is (missing fields, incorrect init_values, checksums that are
correct mod 2**16 but not equal to the result of calc_checksum); these
tests would fail if Record.wrsamp actually required init_value and
checksum fields to match as check_sig_cohesion expects.
This code should be redesigned, and the test cases probably should be
less strict. In the meantime, however, make it clear that this
function isn't actually doing what it was pretending to do.1 parent 3047c17 commit cac2af6
1 file changed
+5
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
156 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
| |||
0 commit comments