MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / Int32FromEnvOrDie

Function Int32FromEnvOrDie

rtpose_wrapper/src/gtest/gtest-all.cpp:5651–5663  ·  view source on GitHub ↗

Parses the environment variable var as an Int32. If it is unset, returns default_val. If it is not an Int32, prints an error and aborts.

Source from the content-addressed store, hash-verified

5649// returns default_val. If it is not an Int32, prints an error
5650// and aborts.
5651Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) {
5652 const char* str_val = posix::GetEnv(var);
5653 if (str_val == NULL) {
5654 return default_val;
5655 }
5656
5657 Int32 result;
5658 if (!ParseInt32(Message() << "The value of environment variable " << var,
5659 str_val, &result)) {
5660 exit(EXIT_FAILURE);
5661 }
5662 return result;
5663}
5664
5665// Given the total number of shards, the shard index, and the test id,
5666// returns true iff the test should be run on this shard. The test id is

Callers 3

OnTestIterationStartMethod · 0.85
ShouldShardFunction · 0.85
FilterTestsMethod · 0.85

Calls 3

GetEnvFunction · 0.85
ParseInt32Function · 0.85
MessageFunction · 0.70

Tested by

no test coverage detected