MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / Int32FromEnvOrDie

Function Int32FromEnvOrDie

tests/gtest/gtest-all.cc:6890–6902  ·  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

6888// returns default_val. If it is not an Int32, prints an error
6889// and aborts.
6890Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) {
6891 const char* str_val = posix::GetEnv(var);
6892 if (str_val == nullptr) {
6893 return default_val;
6894 }
6895
6896 Int32 result;
6897 if (!ParseInt32(Message() << "The value of environment variable " << var,
6898 str_val, &result)) {
6899 exit(EXIT_FAILURE);
6900 }
6901 return result;
6902}
6903
6904// Given the total number of shards, the shard index, and the test id,
6905// 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