title: How to use a user input variable across multiple unit tests?
body: <p>I have a C++11 project with many googletest unit tests looking like</p>
  
  <pre><code>TEST_F(GTest, testSomething) {
      int64_t n = 42;
      // following code depends on input size n
      ...
  }
  </code></pre>
  
  <p>Rather than having a local constant <code>n</code> in each test, I'd like to be able to set the input size from one location, preferably the command line:</p>
  
  <pre><code>./RunMyProgram --gtest_filter=* --n=1000
  </code></pre>
  
  <p>The <code>main</code> should look like:</p>
  
  <pre><code>int main(int argc, char **argv) {
  
       // TODO: parse command line argument n here
  
      INFO("=== starting unit tests ===");
  
      ::testing::InitGoogleTest(&amp;argc, argv);
      return RUN_ALL_TESTS();
  
  }
  </code></pre>
  
  <p>With what should I replace <code>?</code> in my test functions? </p>
  
  <pre><code>TEST_F(GTest, testSomething) {
      int64_t n = ?;
      // following code depends on input size n
      ...
  }
  </code></pre>