Caffe2 - C++ API
A deep learning, cross platform ML framework
file_check.h
1 #pragma once
2 
3 #include <torch/csrc/WindowsTorchApiMacro.h>
4 #include <torch/csrc/jit/testing/file_check.h>
5 
6 namespace torch {
7 namespace jit {
8 
9 struct Graph;
10 
11 namespace testing {
12 
13 struct FileCheckImpl;
14 
15 struct FileCheck {
16  public:
17  TORCH_API explicit FileCheck();
18  TORCH_API ~FileCheck();
19 
20  // Run FileCheck against test string
21  TORCH_API void run(const std::string& test_string);
22 
23  // Run FileCheck against dump of graph IR
24  TORCH_API void run(const Graph& graph);
25 
26  // Checks that the string occurs, starting at the end of the most recent match
27  TORCH_API FileCheck* check(const std::string& str);
28 
29  // Checks that the string does not occur between the previous match and next
30  // match. Consecutive check_nots test against the same previous match and next
31  // match
32  TORCH_API FileCheck* check_not(const std::string& str);
33 
34  // Checks that the string occurs on the same line as the previous match
35  TORCH_API FileCheck* check_same(const std::string& str);
36 
37  // Checks that the string occurs on the line immediately following the
38  // previous match
39  TORCH_API FileCheck* check_next(const std::string& str);
40 
41  // Checks that the string occurs count number of times, starting at the end
42  // of the previous match. If exactly is true, checks that there are exactly
43  // count many matches
44  TORCH_API FileCheck* check_count(
45  const std::string& str,
46  size_t count,
47  bool exactly = false);
48 
49  // A series of consecutive check_dags get turned into a group of checks
50  // which can appear in any order relative to each other. The checks begin
51  // at the end of the previous match, and the match for the check_dag group
52  // is the minimum match of all individual checks to the maximum match of all
53  // individual checks.
54  TORCH_API FileCheck* check_dag(const std::string& str);
55 
56  // reset checks
57  TORCH_API void reset();
58 
59  private:
60  bool has_run = false;
61  std::unique_ptr<FileCheckImpl> fcImpl;
62 };
63 } // namespace testing
64 } // namespace jit
65 } // namespace torch
Definition: jit_type.h:17