Files
PowerShell/test/test-getcurrentprocessid.cpp
T

16 lines
469 B
C++
Raw Normal View History

2015-03-05 14:58:25 -08:00
#include <gtest/gtest.h>
#include "getcurrentprocessorid.h"
// This is a very simple test case to show how tests can be written
TEST(GetCurrentProcessId,simple)
{
2015-11-02 16:40:28 -08:00
const int32_t currentProcessId = GetCurrentProcessId();
2015-03-05 14:58:25 -08:00
const pid_t pid = getpid();
// first make sure that on this platform those types are of the same size
2015-11-02 16:40:28 -08:00
ASSERT_TRUE(sizeof(int32_t) >= sizeof(pid_t));
2015-03-05 14:58:25 -08:00
// now compare the actual values
2015-11-02 16:40:28 -08:00
ASSERT_EQ(currentProcessId,static_cast<int32_t>(pid));
2015-03-05 14:58:25 -08:00
}