Add unittest
authorRoy7Kim <myoungwoon.kim@samsung.com>
Thu, 11 May 2023 04:49:08 +0000 (13:49 +0900)
committerRoy7Kim <myoungwoon.kim@samsung.com>
Thu, 11 May 2023 04:49:19 +0000 (13:49 +0900)
[   20s] + ./smawk
[   20s]
[   20s] running 19 tests
[   20s] test monge::tests::is_monge_handles_overflow ... ok
[   20s] test monge::tests::monge_constant_cols ... ok
[   20s] test monge::tests::monge_constant_rows ... ok
[   20s] test monge::tests::monge_lower_left ... ok
[   20s] test monge::tests::monge_upper_right ... ok
[   20s] test tests::online_1x1 ... ok
[   20s] test tests::online_2x2 ... ok
[   20s] test tests::online_4x4 ... ok
[   20s] test tests::online_3x3 ... ok
[   20s] test tests::online_5x5 ... ok
[   20s] test tests::online_works_with_partial_ord ... ok
[   20s] test tests::smawk_2x2 ... ok
[   20s] test tests::smawk_1x2 ... ok
[   20s] test tests::smawk_1x1 ... ok
[   20s] test tests::smawk_3x3 ... ok
[   20s] test tests::smawk_2x1 ... ok
[   20s] test tests::smawk_4x4 ... ok
[   20s] test tests::smawk_5x5 ... ok
[   20s] test tests::smawk_works_with_partial_ord ... ok
[   20s]
[   20s] test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

packaging/rust-smawk.spec

index cfe757eefc43794caa36ce48054ad3e6f72feb26..0c9acb62f42c24c556b2be91402b5317a676796a 100644 (file)
@@ -56,6 +56,16 @@ cp %{SOURCE1} .
 install -d -m 0755 %{buildroot}%{_rust_dylibdir}
 install -m 0644 lib%{real_crate_name}.so %{buildroot}/%{_rust_dylibdir}/lib%{real_crate_name}.so
 
+%check
+%if 0%{?run_tests}
+%{rustc_std_build} --test --crate-type=dylib \
+        --crate-name=%{real_crate_name} \
+        %{?rustc_edition:--edition=%{rustc_edition}} \
+        ./src/lib.rs
+
+./%{real_crate_name}
+%endif
+
 %clean
 
 %post -p /sbin/ldconfig