Commit 1e6aead
committed
add unit tests for recent typeck bug fixes
These unit tests were written with the help of Claude 4 (it wrong the
tests and I just fixed its miniscript syntax by adding s wrappers).
If you want to try reordering this commit to two commits back (where it
will fail), you need to tweak it a bit because the data structures were
rearranged. This diff will work.
diff --git a/src/miniscript/mod.rs b/src/miniscript/mod.rs
index 2435e50f..cb0b3530 100644
--- a/src/miniscript/mod.rs
+++ b/src/miniscript/mod.rs
@@ -1892,8 +1892,8 @@ mod tests {
// With the fix, or_d dissatisfaction should not have the extra +1
// Both branches have exec_stack_count of 1, so dissat should be max(1,1) = 1, not 2
- if let Some(dissat_data) = ms.ext.dissat_data {
- assert_eq!(dissat_data.max_exec_stack_count, 1);
+ if let Some(dissat_data) = ms.ext.exec_stack_elem_count_dissat{
+ assert_eq!(dissat_data, 1);
} else {
panic!("Expected dissat_data to be Some");
}
@@ -1908,8 +1908,8 @@ mod tests {
// Each pk has exec_stack_count of 1
// With the fix, threshold should take max(1,1,1) = 1, not sum 1+1+1 = 3
- if let Some(sat_data) = ms.ext.sat_data {
- assert_eq!(sat_data.max_exec_stack_count, 1);
+ if let Some(sat_data) = ms.ext.exec_stack_elem_count_sat{
+ assert_eq!(sat_data, 1);
} else {
panic!("Expected sat_data to be Some");
}
@@ -1920,8 +1920,8 @@ mod tests {
// and_v has exec_stack_count of 2, pk has 1
// With the fix: max(2,1) = 2, old code would sum to 3
- if let Some(sat_data) = complex_ms.ext.sat_data {
- assert_eq!(sat_data.max_exec_stack_count, 2);
+ if let Some(sat_data) = complex_ms.ext.exec_stack_elem_count_sat{
+ assert_eq!(sat_data, 2);
} else {
panic!("Expected sat_data to be Some");
}1 parent 5f0072c commit 1e6aead
1 file changed
+44
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1883 | 1883 | | |
1884 | 1884 | | |
1885 | 1885 | | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
1886 | 1930 | | |
1887 | 1931 | | |
1888 | 1932 | | |
| |||
0 commit comments