logo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

//!
//! Helpers.
//!

/// Internal namespace.
pub( crate ) mod private
{

  // zzz : move here test tools

  // /// Pass only if callback fails either returning error or panicing.
  //
  // pub fn should_throw< R, F : FnOnce() -> anyhow::Result< R > >( f : F ) -> anyhow::Result< R >
  // {
  //   f()
  // }

  //

  // #[panic_handler]
  // fn panic( info : &core::panic::PanicInfo ) -> !
  // {
  //   println!( "{:?}", info );
  //   loop {}
  // }

  // pub use test_suite;
  // pub use test_suite_internals;
  // pub use index;

  ///
  /// Required to convert integets to floats.
  ///

  #[ macro_export ]
  macro_rules! num
  {

    () =>
    {
    };

    ( $num : expr ) =>
    {
      num_traits::cast::< _, T >( $num ).unwrap()
    };

    ( $( $num : expr ),+ ) =>
    {(
      $( num_traits::cast::< _, T >( $num ).unwrap() ),+
    )};

  }

  ///
  /// Test a file with documentation.
  ///

  #[ macro_export ]
  macro_rules! doc_file_test
  {
    ( $file:expr ) =>
    {
      #[ allow( unused_doc_comments ) ]
      #[ cfg( doctest ) ]
      #[ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", $file ) ) ]
      extern { }
    };
  }

  pub use num;
  pub use doc_file_test;
}

//

meta_tools::mod_interface!
{
  prelude use
  {
    num,
    doc_file_test,
  };
}