()
| 108 | |
| 109 | #[test] |
| 110 | fn test_input_exceptions() { |
| 111 | let modified_open = { |
| 112 | let mut t = table("open_df.csv"); |
| 113 | t.index.push("2020-01-01".to_string()); |
| 114 | t.values.push(vec![4.0; t.columns.len()]); |
| 115 | t |
| 116 | }; |
| 117 | |
| 118 | let result = EtfTrick::from_tables( |
| 119 | modified_open, |
| 120 | table("close_df.csv"), |
| 121 | table("alloc_df.csv"), |
| 122 | table("costs_df.csv"), |
| 123 | None, |
| 124 | ); |
| 125 | assert!(result.is_err()); |
| 126 | |
| 127 | let open_path = fixture_path("open_df.csv"); |
| 128 | let close_path = fixture_path("close_df.csv"); |
| 129 | let alloc_path = fixture_path("alloc_df.csv"); |
| 130 | let costs_path = fixture_path("costs_df.csv"); |
| 131 | let csv_etf_trick = |
| 132 | EtfTrick::from_csv(&open_path, &close_path, &alloc_path, &costs_path, None).unwrap(); |
| 133 | assert!(csv_etf_trick.get_etf_series(2).is_err()); |
| 134 | } |
| 135 | |
| 136 | /// The numbers printed on docs-site/src/content/docs/modules/etf-trick.md. The docs gate only |
| 137 | /// compiles Rust examples, so the output shown there is pinned here instead. |
nothing calls this directly
no test coverage detected