File: count_paths.rs

package info (click to toggle)
rust-pathfinding 4.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 1,024 kB
  • sloc: sh: 19; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 322 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use pathfinding::directed::count_paths::count_paths;

#[test]
fn grid() {
    let n = count_paths(
        (0, 0),
        |&(x, y)| {
            [(x + 1, y), (x, y + 1)]
                .into_iter()
                .filter(|&(x, y)| x < 8 && y < 8)
        },
        |&c| c == (7, 7),
    );
    assert_eq!(n, 3432);
}