diff --git a/Simulator/Core/Core.cpp b/Simulator/Core/Core.cpp index da1c59bce..0488ba125 100644 --- a/Simulator/Core/Core.cpp +++ b/Simulator/Core/Core.cpp @@ -206,7 +206,7 @@ int Core::runSimulation(string executableName, string cmdLineArguments) } // Helper function for recorder to register spike history variables for all neurons. - simulator.getModel().getLayout().getVertices().registerHistoryVariables(); + OperationManager::getInstance().executeOperation(Operations::registerHistoryVariables); // Run simulation LOG4CPLUS_TRACE(consoleLogger, "Starting Simulation"); diff --git a/Simulator/Core/GPUModel.cpp b/Simulator/Core/GPUModel.cpp index 5aaf15571..da7b9cbbd 100644 --- a/Simulator/Core/GPUModel.cpp +++ b/Simulator/Core/GPUModel.cpp @@ -12,6 +12,8 @@ #include "AllVertices.h" #include "Connections.h" #include "Global.h" +#include "OperationManager.h" + #ifdef VALIDATION_MODE #include "AllIFNeurons.h" #include "OperationManager.h" @@ -27,51 +29,51 @@ GPUModel::GPUModel() : Model::Model(), edgeIndexMapDevice_(nullptr), randNoise_d(nullptr), allVerticesDevice_(nullptr), allEdgesDevice_(nullptr) { + // Register allocNeuronDeviceStruct function as a allocateGPU operation in the OperationManager + function allocateGPU = bind(&GPUModel::allocDeviceStruct, this); + OperationManager::getInstance().registerOperation(Operations::allocateGPU, allocateGPU); + + // Register copyCPUtoGPU function as a copyCPUtoGPU operation in the OperationManager + function copyCPUtoGPU = bind(&GPUModel::copyCPUtoGPU, this); + OperationManager::getInstance().registerOperation(Operations::copyToGPU, copyCPUtoGPU); + + // Note: We do not register a corresponding copyFromGPU operation here because + // we are only copying the synapseIndexMap to the GPU. This map is a read-only lookup table + // that gets recreated from scratch on each update. As a result, we only need to allocate, + // copy to GPU, and deallocate — there is no meaningful data to copy back from the GPU. + + // Register deleteSynapseImap function as a deallocateGPUMemory operation in the OperationManager + function deallocateGPUMemory = bind(&GPUModel::deleteDeviceStruct, this); + OperationManager::getInstance().registerOperation(Operations::deallocateGPUMemory, + deallocateGPUMemory); } /// Allocates and initializes memories on CUDA device. -/// @param[out] allVerticesDevice Memory location of the pointer to the vertices list on device memory. -/// @param[out] allEdgesDevice Memory location of the pointer to the edges list on device memory. -void GPUModel::allocDeviceStruct(void **allVerticesDevice, void **allEdgesDevice) +void GPUModel::allocDeviceStruct() { - // Get vertices and edges - AllVertices &vertices = layout_->getVertices(); - AllEdges &edges = connections_->getEdges(); - - // Allocate vertices and edges structs on GPU device memory - vertices.allocVerticesDeviceStruct(allVerticesDevice); - edges.allocEdgeDeviceStruct(allEdgesDevice); - // Allocate memory for random noise array int numVertices = Simulator::getInstance().getTotalVertices(); BGSIZE randNoise_d_size = numVertices * sizeof(float); // size of random noise array HANDLE_ERROR(cudaMalloc((void **)&randNoise_d, randNoise_d_size)); - // Copy host vertex and edge arrays into GPU device - vertices.copyToDevice(*allVerticesDevice); - edges.copyEdgeHostToDevice(*allEdgesDevice); - - // Allocate edge inverse map in device memory + // Allocate synapse inverse map in device memory allocEdgeIndexMap(numVertices); } /// Copies device memories to host memories and deallocates them. -/// @param[out] allVerticesDevice Memory location of the pointer to the vertices list on device memory. -/// @param[out] allEdgesDevice Memory location of the pointer to the edges list on device memory. -void GPUModel::deleteDeviceStruct(void **allVerticesDevice, void **allEdgesDevice) +void GPUModel::deleteDeviceStruct() { - // Get vertices and edges - AllVertices &vertices = layout_->getVertices(); - AllEdges &edges = connections_->getEdges(); - - // Copy device edge and vertex structs to host memory - vertices.copyFromDevice(*allVerticesDevice); - // Deallocate device memory - vertices.deleteVerticesDeviceStruct(*allVerticesDevice); - // Copy device edge and vertex structs to host memory - edges.copyEdgeDeviceToHost(*allEdgesDevice); // Deallocate device memory - edges.deleteEdgeDeviceStruct(*allEdgesDevice); + EdgeIndexMapDevice synapseIMapDevice; + HANDLE_ERROR(cudaMemcpy(&synapseIMapDevice, edgeIndexMapDevice_, sizeof(EdgeIndexMapDevice), + cudaMemcpyDeviceToHost)); + HANDLE_ERROR(cudaFree(synapseIMapDevice.outgoingEdgeBegin_)); + HANDLE_ERROR(cudaFree(synapseIMapDevice.outgoingEdgeCount_)); + HANDLE_ERROR(cudaFree(synapseIMapDevice.outgoingEdgeIndexMap_)); + HANDLE_ERROR(cudaFree(synapseIMapDevice.incomingEdgeBegin_)); + HANDLE_ERROR(cudaFree(synapseIMapDevice.incomingEdgeCount_)); + HANDLE_ERROR(cudaFree(synapseIMapDevice.incomingEdgeIndexMap_)); + HANDLE_ERROR(cudaFree(edgeIndexMapDevice_)); HANDLE_ERROR(cudaFree(randNoise_d)); } @@ -104,13 +106,9 @@ void GPUModel::setupSim() t_gpu_advanceSynapses = 0.0; t_gpu_calcSummation = 0.0; #endif // PERFORMANCE_METRICS - - // allocates memories on CUDA device - allocDeviceStruct((void **)&allVerticesDevice_, (void **)&allEdgesDevice_); - - EdgeIndexMap &edgeIndexMap = connections_->getEdgeIndexMap(); - // copy inverse map to the device memory - copyEdgeIndexMapHostToDevice(edgeIndexMap, Simulator::getInstance().getTotalVertices()); + // Allocate and copy neuron/synapse data structures to GPU memory + OperationManager::getInstance().executeOperation(Operations::allocateGPU); + OperationManager::getInstance().executeOperation(Operations::copyToGPU); AllEdges &edges = connections_->getEdges(); // set some parameters used for advanceVerticesDevice @@ -123,9 +121,10 @@ void GPUModel::setupSim() /// Performs any finalization tasks on network following a simulation. void GPUModel::finish() { + // copy device synapse and neuron structs to host memory + OperationManager::getInstance().executeOperation(Operations::copyFromGPU); // deallocates memories on CUDA device - deleteDeviceStruct((void **)&allVerticesDevice_, (void **)&allEdgesDevice_); - deleteEdgeIndexMap(); + OperationManager::getInstance().executeOperation(Operations::deallocateGPUMemory); #ifdef PERFORMANCE_METRICS cudaEventDestroy(start); @@ -234,7 +233,7 @@ void GPUModel::updateConnections() AllVertices &vertices = layout_->getVertices(); AllEdges &edges = connections_->getEdges(); - vertices.copyFromDevice(allVerticesDevice_); + vertices.copyFromDevice(); // Update Connections data if (connections_->updateConnections(vertices)) { @@ -243,8 +242,7 @@ void GPUModel::updateConnections() // create edge index map connections_->createEdgeIndexMap(); // copy index map to the device memory - copyEdgeIndexMapHostToDevice(connections_->getEdgeIndexMap(), - Simulator::getInstance().getTotalVertices()); + copyCPUtoGPU(); } } @@ -281,83 +279,119 @@ void GPUModel::allocEdgeIndexMap(int count) cudaMemcpyHostToDevice)); } -/// Deallocate device memory for edge inverse map. -void GPUModel::deleteEdgeIndexMap() +/// Calculate the sum of synaptic input to each neuron. +/// +/// Calculate the sum of synaptic input to each neuron. One thread +/// corresponds to one neuron. Iterates sequentially through the +/// forward synapse index map (edgeIndexMapDevice_) to access only +/// existing synapses. Using this structure eliminates the need to skip +/// synapses that have undergone lazy deletion from the main +/// (allEdgesDevice) synapse structure. The forward map is +/// re-computed during each network restructure (once per epoch) to +/// ensure that all synapse pointers for a neuron are stored +/// contiguously. +/// +/// @param[in] totalVertices Number of vertices in the entire simulation. +/// @param[in,out] allVerticesDevice Pointer to Neuron structures in device memory. +/// @param[in] edgeIndexMapDevice_ Pointer to forward map structures in device memory. +/// @param[in] allEdgesDevice Pointer to Synapse structures in device memory. +__global__ void + calcSummationPointDevice(int totalVertices, + AllSpikingNeuronsDeviceProperties *__restrict__ allVerticesDevice, + const EdgeIndexMapDevice *__restrict__ edgeIndexMapDevice_, + const AllSpikingSynapsesDeviceProperties *__restrict__ allEdgesDevice) { - EdgeIndexMapDevice edgeIndexMapDevice; - HANDLE_ERROR(cudaMemcpy(&edgeIndexMapDevice, edgeIndexMapDevice_, sizeof(EdgeIndexMapDevice), - cudaMemcpyDeviceToHost)); - HANDLE_ERROR(cudaFree(edgeIndexMapDevice.outgoingEdgeBegin_)); - HANDLE_ERROR(cudaFree(edgeIndexMapDevice.outgoingEdgeCount_)); - HANDLE_ERROR(cudaFree(edgeIndexMapDevice.outgoingEdgeIndexMap_)); - HANDLE_ERROR(cudaFree(edgeIndexMapDevice.incomingEdgeBegin_)); - HANDLE_ERROR(cudaFree(edgeIndexMapDevice.incomingEdgeCount_)); - HANDLE_ERROR(cudaFree(edgeIndexMapDevice.incomingEdgeIndexMap_)); - HANDLE_ERROR(cudaFree(edgeIndexMapDevice_)); + // The usual thread ID calculation and guard against excess threads + // (beyond the number of vertices, in this case). + int idx = blockIdx.x * blockDim.x + threadIdx.x; + if (idx >= totalVertices) + return; + + // Number of incoming synapses + const BGSIZE synCount = edgeIndexMapDevice_->incomingEdgeCount_[idx]; + // Optimization: terminate thread if no incoming synapses + if (synCount != 0) { + // Index of start of this neuron's block of forward map entries + const int beginIndex = edgeIndexMapDevice_->incomingEdgeBegin_[idx]; + // Address of the start of this neuron's block of forward map entries + const BGSIZE *activeMapBegin = &(edgeIndexMapDevice_->incomingEdgeIndexMap_[beginIndex]); + // Summed post-synaptic response (PSR) + BGFLOAT sum = 0.0; + // Index of the current incoming synapse + BGSIZE synIndex; + // Repeat for each incoming synapse + for (BGSIZE i = 0; i < synCount; i++) { + // Get index of current incoming synapse + synIndex = activeMapBegin[i]; + // Fetch its PSR and add into sum + sum += allEdgesDevice->psr_[synIndex]; + } + // Store summed PSR into this neuron's summation point + allVerticesDevice->summationPoints_[idx] = sum; + } } -/// Copy EdgeIndexMap in host memory to EdgeIndexMap in device memory. -/// @param edgeIndexMapHost Reference to the EdgeIndexMap in host memory. -void GPUModel::copyEdgeIndexMapHostToDevice(EdgeIndexMap &edgeIndexMapHost, int numVertices) +/// Allocate and Copy CPU Synapse data to GPU. +void GPUModel::copyCPUtoGPU() { - AllEdges &edges = connections_->getEdges(); - int totalEdgeCount = edges.totalEdgeCount_; - if (totalEdgeCount == 0) + EdgeIndexMap synapseIndexMapHost = connections_->getEdgeIndexMap(); + int numVertices = Simulator::getInstance().getTotalVertices(); + AllEdges &synapses = connections_->getEdges(); + int totalSynapseCount = dynamic_cast(synapses).totalEdgeCount_; + if (totalSynapseCount == 0) return; - EdgeIndexMapDevice edgeIndexMapDevice; - HANDLE_ERROR(cudaMemcpy(&edgeIndexMapDevice, edgeIndexMapDevice_, sizeof(EdgeIndexMapDevice), + EdgeIndexMapDevice synapseIMapDevice; + HANDLE_ERROR(cudaMemcpy(&synapseIMapDevice, edgeIndexMapDevice_, sizeof(EdgeIndexMapDevice), cudaMemcpyDeviceToHost)); - HANDLE_ERROR(cudaMemcpy(edgeIndexMapDevice.outgoingEdgeBegin_, - edgeIndexMapHost.outgoingEdgeBegin_.data(), numVertices * sizeof(BGSIZE), - cudaMemcpyHostToDevice)); - HANDLE_ERROR(cudaMemcpy(edgeIndexMapDevice.outgoingEdgeCount_, - edgeIndexMapHost.outgoingEdgeCount_.data(), numVertices * sizeof(BGSIZE), - cudaMemcpyHostToDevice)); - if (edgeIndexMapDevice.outgoingEdgeIndexMap_ != nullptr) { - HANDLE_ERROR(cudaFree(edgeIndexMapDevice.outgoingEdgeIndexMap_)); + HANDLE_ERROR(cudaMemcpy(synapseIMapDevice.outgoingEdgeBegin_, + synapseIndexMapHost.outgoingEdgeBegin_.data(), + numVertices * sizeof(BGSIZE), cudaMemcpyHostToDevice)); + HANDLE_ERROR(cudaMemcpy(synapseIMapDevice.outgoingEdgeCount_, + synapseIndexMapHost.outgoingEdgeCount_.data(), + numVertices * sizeof(BGSIZE), cudaMemcpyHostToDevice)); + if (synapseIMapDevice.outgoingEdgeIndexMap_ != nullptr) { + HANDLE_ERROR(cudaFree(synapseIMapDevice.outgoingEdgeIndexMap_)); } - HANDLE_ERROR(cudaMalloc((void **)&edgeIndexMapDevice.outgoingEdgeIndexMap_, - totalEdgeCount * sizeof(BGSIZE))); - HANDLE_ERROR(cudaMemcpy(edgeIndexMapDevice.outgoingEdgeIndexMap_, - edgeIndexMapHost.outgoingEdgeIndexMap_.data(), - totalEdgeCount * sizeof(BGSIZE), cudaMemcpyHostToDevice)); + HANDLE_ERROR(cudaMalloc((void **)&synapseIMapDevice.outgoingEdgeIndexMap_, + totalSynapseCount * sizeof(BGSIZE))); + HANDLE_ERROR(cudaMemcpy(synapseIMapDevice.outgoingEdgeIndexMap_, + synapseIndexMapHost.outgoingEdgeIndexMap_.data(), + totalSynapseCount * sizeof(BGSIZE), cudaMemcpyHostToDevice)); // active synapse map - HANDLE_ERROR(cudaMemcpy(edgeIndexMapDevice.incomingEdgeBegin_, - edgeIndexMapHost.incomingEdgeBegin_.data(), numVertices * sizeof(BGSIZE), - cudaMemcpyHostToDevice)); - HANDLE_ERROR(cudaMemcpy(edgeIndexMapDevice.incomingEdgeCount_, - edgeIndexMapHost.incomingEdgeCount_.data(), numVertices * sizeof(BGSIZE), - cudaMemcpyHostToDevice)); + HANDLE_ERROR(cudaMemcpy(synapseIMapDevice.incomingEdgeBegin_, + synapseIndexMapHost.incomingEdgeBegin_.data(), + numVertices * sizeof(BGSIZE), cudaMemcpyHostToDevice)); + HANDLE_ERROR(cudaMemcpy(synapseIMapDevice.incomingEdgeCount_, + synapseIndexMapHost.incomingEdgeCount_.data(), + numVertices * sizeof(BGSIZE), cudaMemcpyHostToDevice)); // the number of synapses may change, so we reallocate the memory - if (edgeIndexMapDevice.incomingEdgeIndexMap_ != nullptr) { - HANDLE_ERROR(cudaFree(edgeIndexMapDevice.incomingEdgeIndexMap_)); - edgeIndexMapDevice.incomingEdgeIndexMap_ = nullptr; + if (synapseIMapDevice.incomingEdgeIndexMap_ != nullptr) { + HANDLE_ERROR(cudaFree(synapseIMapDevice.incomingEdgeIndexMap_)); + synapseIMapDevice.incomingEdgeIndexMap_ = nullptr; } - HANDLE_ERROR(cudaMalloc((void **)&edgeIndexMapDevice.incomingEdgeIndexMap_, - totalEdgeCount * sizeof(BGSIZE))); - HANDLE_ERROR(cudaMemcpy(edgeIndexMapDevice.incomingEdgeIndexMap_, - edgeIndexMapHost.incomingEdgeIndexMap_.data(), - totalEdgeCount * sizeof(BGSIZE), cudaMemcpyHostToDevice)); - HANDLE_ERROR(cudaMemcpy(edgeIndexMapDevice_, &edgeIndexMapDevice, sizeof(EdgeIndexMapDevice), + HANDLE_ERROR(cudaMalloc((void **)&synapseIMapDevice.incomingEdgeIndexMap_, + totalSynapseCount * sizeof(BGSIZE))); + HANDLE_ERROR(cudaMemcpy(synapseIMapDevice.incomingEdgeIndexMap_, + synapseIndexMapHost.incomingEdgeIndexMap_.data(), + totalSynapseCount * sizeof(BGSIZE), cudaMemcpyHostToDevice)); + HANDLE_ERROR(cudaMemcpy(edgeIndexMapDevice_, &synapseIMapDevice, sizeof(EdgeIndexMapDevice), cudaMemcpyHostToDevice)); } -/// Copy GPU edge data to CPU. -void GPUModel::copyGPUtoCPU() +/// Print out EdgeProps on the GPU. +void GPUModel::printGPUEdgesPropsModel() const { - // copy device edge structs to host memory - connections_->getEdges().copyEdgeDeviceToHost(allEdgesDevice_); + connections_->getEdges().printGPUEdgesProps(allEdgesDevice_); } -/// Copy CPU edge data to GPU. -void GPUModel::copyCPUtoGPU() +/// Getter for neuron structure in device memory +AllVerticesDeviceProperties *&GPUModel::getAllVerticesDevice() { - // copy host edge structs to device memory - connections_->getEdges().copyEdgeHostToDevice(allEdgesDevice_); + return allVerticesDevice_; } -/// Print out EdgeProps on the GPU. -void GPUModel::printGPUEdgesPropsModel() const +/// Getter for synapse structures in device memory +AllEdgesDeviceProperties *&GPUModel::getAllEdgesDevice() { - connections_->getEdges().printGPUEdgesProps(allEdgesDevice_); -} + return allEdgesDevice_; +} \ No newline at end of file diff --git a/Simulator/Core/GPUModel.h b/Simulator/Core/GPUModel.h index c3987f960..52da5187d 100644 --- a/Simulator/Core/GPUModel.h +++ b/Simulator/Core/GPUModel.h @@ -22,7 +22,10 @@ #pragma once #include "AllEdges.h" +#include "AllSpikingNeurons.h" +#include "AllSpikingSynapses.h" #include "AllVertices.h" +#include "OperationManager.h" #ifdef VALIDATION_MODE #include @@ -81,25 +84,33 @@ class GPUModel : public Model { /// over the past epoch. Should be called once every epoch. virtual void updateConnections() override; - /// Copy GPU edge data to CPU. - virtual void copyGPUtoCPU() override; - - /// Copy CPU edge data to GPU. + /// Copies neuron and synapse data from CPU to GPU memory. + /// TODO: Refactor this. Currently, GPUModel handles low-level memory transfer for vertices and edges. + /// Consider moving this responsibility to a more appropriate class, such as a dedicated memory manager + /// or the OperationManager, to better separate concerns and keep the model focused on high-level coordination. virtual void copyCPUtoGPU() override; + // GPUModel itself does not have anything to be copied back, this function is a + // dummy function just to make GPUModel non virtual + virtual void copyGPUtoCPU() override + { + } + /// Print out EdgeProps on the GPU. void printGPUEdgesPropsModel() const; + /// Getter for edge (synapse) structures in device memory + AllEdgesDeviceProperties *&getAllEdgesDevice(); + + /// Getter for vertex (neuron) structures in device memory + AllVerticesDeviceProperties *&getAllVerticesDevice(); + protected: /// Allocates and initializes memories on CUDA device. - /// @param[out] allVerticesDevice Memory location of the pointer to the vertices list on device memory. - /// @param[out] allEdgesDevice Memory location of the pointer to the edges list on device memory. - void allocDeviceStruct(void **allVerticesDevice, void **allEdgesDevice); + void allocDeviceStruct(); - /// Copies device memories to host memories and deallocates them. - /// @param[out] allVerticesDevice Memory location of the pointer to the vertices list on device memory. - /// @param[out] allEdgesDevice Memory location of the pointer to the edges list on device memory. - virtual void deleteDeviceStruct(void **allVerticesDevice, void **allEdgesDevice); + /// Deallocates device memories. + virtual void deleteDeviceStruct(); /// Pointer to device random noise array. float *randNoise_d; @@ -118,11 +129,6 @@ class GPUModel : public Model { private: void allocEdgeIndexMap(int count); - void deleteEdgeIndexMap(); - -public: //2020/03/14 changed to public for accessing in Core - void copyEdgeIndexMapHostToDevice(EdgeIndexMap &edgeIndexMapHost, int numVertices); - private: void updateHistory(); diff --git a/Simulator/Core/OperationManager.cpp b/Simulator/Core/OperationManager.cpp index dda9e411a..f51753005 100644 --- a/Simulator/Core/OperationManager.cpp +++ b/Simulator/Core/OperationManager.cpp @@ -71,6 +71,8 @@ string OperationManager::operationToString(const Operations &operation) const return "copyToGPU"; case Operations::copyFromGPU: return "copyFromGPU"; + case Operations::allocateGPU: + return "allocateGPU"; default: return "Operation isn't in OperationManager::operationToString()"; } diff --git a/Simulator/Core/Operations.h b/Simulator/Core/Operations.h index 8cd21f3b6..ba3030421 100644 --- a/Simulator/Core/Operations.h +++ b/Simulator/Core/Operations.h @@ -20,5 +20,7 @@ enum class Operations { deallocateGPUMemory, // Make sure deallocate memory isn't called until all GPU memory is copied back. restoreToDefault, // Not sure what this refers to. copyToGPU, - copyFromGPU -}; \ No newline at end of file + copyFromGPU, + allocateGPU, + registerHistoryVariables +}; diff --git a/Simulator/Core/Serializer.cpp b/Simulator/Core/Serializer.cpp index 4b90fbc04..23b72a7f4 100644 --- a/Simulator/Core/Serializer.cpp +++ b/Simulator/Core/Serializer.cpp @@ -67,8 +67,7 @@ bool Serializer::deserialize() #if defined(USE_GPU) GPUModel &gpuModel = static_cast(simulator.getModel()); - gpuModel.copyEdgeIndexMapHostToDevice(simulator.getModel().getConnections().getEdgeIndexMap(), - simulator.getTotalVertices()); + gpuModel.copyCPUtoGPU(); #endif // USE_GPU return true; diff --git a/Simulator/Edges/AllEdges.cpp b/Simulator/Edges/AllEdges.cpp index ecdd1c21a..20c70a4de 100644 --- a/Simulator/Edges/AllEdges.cpp +++ b/Simulator/Edges/AllEdges.cpp @@ -26,6 +26,28 @@ AllEdges::AllEdges() : totalEdgeCount_(0), maxEdgesPerVertex_(0), countVertices_ OperationManager::getInstance().registerOperation(Operations::printParameters, printParametersFunc); +#if defined(USE_GPU) + // Register allocNeuronDeviceStruct function as a allocateGPU operation in the OperationManager + function allocateGPU + = bind(static_cast(&AllEdges::allocEdgeDeviceStruct), this); + OperationManager::getInstance().registerOperation(Operations::allocateGPU, allocateGPU); + + // Register AllEdges::copyEdgeHostToDevice function as a copyToGPU operation in the OperationManager + function copyCPUtoGPU + = bind(static_cast(&AllEdges::copyEdgeHostToDevice), this); + OperationManager::getInstance().registerOperation(Operations::copyToGPU, copyCPUtoGPU); + + // Register copyFromGPU operation for transferring edge data from device to host + function copyFromGPU = bind(&AllEdges::copyEdgeDeviceToHost, this); + OperationManager::getInstance().registerOperation(Operations::copyFromGPU, copyFromGPU); + + // Register deleteEdgeDeviceStruct function as a deallocateGPUMemory operation in the OperationManager + function deallocateGPUMemory = bind(&AllEdges::deleteEdgeDeviceStruct, this); + OperationManager::getInstance().registerOperation(Operations::deallocateGPUMemory, + deallocateGPUMemory); + +#endif + fileLogger_ = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("file")); edgeLogger_ = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("edge")); } diff --git a/Simulator/Edges/AllEdges.h b/Simulator/Edges/AllEdges.h index 72605ef53..ff1199615 100644 --- a/Simulator/Edges/AllEdges.h +++ b/Simulator/Edges/AllEdges.h @@ -95,9 +95,7 @@ class AllEdges { public: /// Allocate GPU memories to store all edges' states, /// and copy them from host to GPU memory. - /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void allocEdgeDeviceStruct(void **allEdgesDevice) = 0; + virtual void allocEdgeDeviceStruct() = 0; /// Allocate GPU memories to store all edges' states, /// and copy them from host to GPU memory. @@ -110,13 +108,10 @@ class AllEdges { /// Delete GPU memories. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void deleteEdgeDeviceStruct(void *allEdgesDevice) = 0; + virtual void deleteEdgeDeviceStruct() = 0; /// Copy all edges' data from host to device. - /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void copyEdgeHostToDevice(void *allEdgesDevice) = 0; + virtual void copyEdgeHostToDevice() = 0; /// Copy all edges' data from host to device. /// @@ -128,8 +123,7 @@ class AllEdges { /// Copy all edges' data from device to host. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void copyEdgeDeviceToHost(void *allEdgesDevice) = 0; + virtual void copyEdgeDeviceToHost() = 0; /// Get edge_counts in AllEdges struct on device memory. /// diff --git a/Simulator/Edges/NG911/All911Edges.h b/Simulator/Edges/NG911/All911Edges.h index 6b1c288cf..1446dc1d4 100644 --- a/Simulator/Edges/NG911/All911Edges.h +++ b/Simulator/Edges/NG911/All911Edges.h @@ -65,14 +65,14 @@ class All911Edges : public AllEdges { // GPU functionality for 911 simulation is unimplemented. // These signatures are required to make the class non-abstract public: - virtual void allocEdgeDeviceStruct(void **allEdgesDevice) {}; + virtual void allocEdgeDeviceStruct() {}; virtual void allocEdgeDeviceStruct(void **allEdgesDevice, int numVertices, int maxEdgesPerVertex) {}; - virtual void deleteEdgeDeviceStruct(void *allEdgesDevice) {}; - virtual void copyEdgeHostToDevice(void *allEdgesDevice) {}; + virtual void deleteEdgeDeviceStruct() {}; + virtual void copyEdgeHostToDevice() {}; virtual void copyEdgeHostToDevice(void *allEdgesDevice, int numVertices, int maxEdgesPerVertex) { }; - virtual void copyEdgeDeviceToHost(void *allEdgesDevice) {}; + virtual void copyEdgeDeviceToHost() {}; virtual void copyDeviceEdgeCountsToHost(void *allEdgesDevice) {}; virtual void advanceEdges(void *allEdgesDevice, void *allVerticesDevice, void *edgeIndexMapDevice) {}; diff --git a/Simulator/Edges/Neuro/AllDSSynapses.h b/Simulator/Edges/Neuro/AllDSSynapses.h index 47427e679..9459f3a25 100644 --- a/Simulator/Edges/Neuro/AllDSSynapses.h +++ b/Simulator/Edges/Neuro/AllDSSynapses.h @@ -121,9 +121,7 @@ class AllDSSynapses : public AllSpikingSynapses { public: /// Allocate GPU memories to store all synapses' states, /// and copy them from host to GPU memory. - /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void allocEdgeDeviceStruct(void **allEdgesDevice) override; + virtual void allocEdgeDeviceStruct() override; /// Allocate GPU memories to store all synapses' states, /// and copy them from host to GPU memory. @@ -136,13 +134,11 @@ class AllDSSynapses : public AllSpikingSynapses { /// Delete GPU memories. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void deleteEdgeDeviceStruct(void *allEdgesDevice) override; + virtual void deleteEdgeDeviceStruct() override; /// Copy all synapses' data from host to device. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void copyEdgeHostToDevice(void *allEdgesDevice) override; + virtual void copyEdgeHostToDevice() override; /// Copy all synapses' data from host to device. /// @@ -154,8 +150,7 @@ class AllDSSynapses : public AllSpikingSynapses { /// Copy all synapses' data from device to host. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void copyEdgeDeviceToHost(void *allEdgesDevice) override; + virtual void copyEdgeDeviceToHost() override; /// Set synapse class ID defined by enumClassSynapses for the caller's Synapse class. /// The class ID will be set to classSynapses_d in device memory, diff --git a/Simulator/Edges/Neuro/AllDSSynapses_d.cpp b/Simulator/Edges/Neuro/AllDSSynapses_d.cpp index d1783e969..535348816 100644 --- a/Simulator/Edges/Neuro/AllDSSynapses_d.cpp +++ b/Simulator/Edges/Neuro/AllDSSynapses_d.cpp @@ -14,11 +14,10 @@ /// Allocate GPU memories to store all synapses' states, /// and copy them from host to GPU memory. -/// -/// @param allEdgesDevice GPU address of the AllDSSynapsesDeviceProperties struct -/// on device memory. -void AllDSSynapses::allocEdgeDeviceStruct(void **allEdgesDevice) +void AllDSSynapses::allocEdgeDeviceStruct() { + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void **allEdgesDevice = reinterpret_cast(&(gpuModel->getAllEdgesDevice())); allocEdgeDeviceStruct(allEdgesDevice, Simulator::getInstance().getTotalVertices(), Simulator::getInstance().getMaxEdgesPerVertex()); } @@ -67,12 +66,11 @@ void AllDSSynapses::allocDeviceStruct(AllDSSynapsesDeviceProperties &allEdges, i /// Delete GPU memories. /// -/// @param allEdgesDevice GPU address of the AllDSSynapsesDeviceProperties struct -/// on device memory. -void AllDSSynapses::deleteEdgeDeviceStruct(void *allEdgesDevice) +void AllDSSynapses::deleteEdgeDeviceStruct() { AllDSSynapsesDeviceProperties allEdges; - + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allEdgesDevice = static_cast(gpuModel->getAllEdgesDevice()); HANDLE_ERROR(cudaMemcpy(&allEdges, allEdgesDevice, sizeof(AllDSSynapsesDeviceProperties), cudaMemcpyDeviceToHost)); @@ -100,10 +98,10 @@ void AllDSSynapses::deleteDeviceStruct(AllDSSynapsesDeviceProperties &allEdgesDe /// Copy all synapses' data from host to device. /// -/// @param allEdgesDevice GPU address of the AllDSSynapsesDeviceProperties struct -/// on device memory. -void AllDSSynapses::copyEdgeHostToDevice(void *allEdgesDevice) +void AllDSSynapses::copyEdgeHostToDevice() { // copy everything necessary + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allEdgesDevice = static_cast(gpuModel->getAllEdgesDevice()); copyEdgeHostToDevice(allEdgesDevice, Simulator::getInstance().getTotalVertices(), Simulator::getInstance().getMaxEdgesPerVertex()); } @@ -156,13 +154,12 @@ void AllDSSynapses::copyHostToDevice(void *allEdgesDevice, /// Copy all synapses' data from device to host. /// -/// @param allEdgesDevice GPU address of the AllDSSynapsesDeviceProperties struct -/// on device memory. -void AllDSSynapses::copyEdgeDeviceToHost(void *allEdgesDevice) +void AllDSSynapses::copyEdgeDeviceToHost() { // copy everything necessary AllDSSynapsesDeviceProperties allEdgesDeviceProps; - + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allEdgesDevice = static_cast(gpuModel->getAllEdgesDevice()); HANDLE_ERROR(cudaMemcpy(&allEdgesDeviceProps, allEdgesDevice, sizeof(AllDSSynapsesDeviceProperties), cudaMemcpyDeviceToHost)); @@ -328,7 +325,8 @@ void AllDSSynapses::printGPUEdgesProps(void *allEdgesDeviceProps) const } for (int i = 0; i < countVertices_; i++) { - cout << "GPU edge_counts:" << "neuron[" << i << "]" << synapseCountsPrint[i] << endl; + cout << "GPU edge_counts:" + << "neuron[" << i << "]" << synapseCountsPrint[i] << endl; } cout << "GPU totalSynapseCount:" << totalSynapseCountPrint << endl; diff --git a/Simulator/Edges/Neuro/AllDynamicSTDPSynapses.h b/Simulator/Edges/Neuro/AllDynamicSTDPSynapses.h index 2d5c6e79d..578396558 100644 --- a/Simulator/Edges/Neuro/AllDynamicSTDPSynapses.h +++ b/Simulator/Edges/Neuro/AllDynamicSTDPSynapses.h @@ -124,10 +124,8 @@ class AllDynamicSTDPSynapses : public AllSTDPSynapses { #if defined(USE_GPU) public: /// Allocate GPU memories to store all synapses' states, - /// and copy them from host to GPU memory. - /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void allocEdgeDeviceStruct(void **allEdgesDevice) override; + /// and copy them from host to GPU memory. memory. + virtual void allocEdgeDeviceStruct() override; /// Allocate GPU memories to store all synapses' states, /// and copy them from host to GPU memory. @@ -139,13 +137,11 @@ class AllDynamicSTDPSynapses : public AllSTDPSynapses { /// Delete GPU memories. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void deleteEdgeDeviceStruct(void *allEdgesDevice) override; + virtual void deleteEdgeDeviceStruct() override; /// Copy all synapses' data from host to device. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void copyEdgeHostToDevice(void *allEdgesDevice) override; + virtual void copyEdgeHostToDevice() override; /// Copy all synapses' data from host to device. /// @@ -157,8 +153,7 @@ class AllDynamicSTDPSynapses : public AllSTDPSynapses { /// Copy all synapses' data from device to host. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void copyEdgeDeviceToHost(void *allEdgesDevice) override; + virtual void copyEdgeDeviceToHost() override; /// Set synapse class ID defined by enumClassSynapses for the caller's Synapse class. /// The class ID will be set to classSynapses_d in device memory, diff --git a/Simulator/Edges/Neuro/AllDynamicSTDPSynapses_d.cpp b/Simulator/Edges/Neuro/AllDynamicSTDPSynapses_d.cpp index 1c676b19e..2382ba4b9 100644 --- a/Simulator/Edges/Neuro/AllDynamicSTDPSynapses_d.cpp +++ b/Simulator/Edges/Neuro/AllDynamicSTDPSynapses_d.cpp @@ -9,15 +9,15 @@ #include "AllDynamicSTDPSynapses.h" #include "AllSynapsesDeviceFuncs.h" #include "Book.h" +#include "GPUModel.h" #include "Simulator.h" /// Allocate GPU memories to store all synapses' states, /// and copy them from host to GPU memory. -/// -/// @param allEdgesDevice GPU address of the AllDynamicSTDPSynapsesDeviceProperties struct -/// on device memory. -void AllDynamicSTDPSynapses::allocEdgeDeviceStruct(void **allEdgesDevice) +void AllDynamicSTDPSynapses::allocEdgeDeviceStruct() { + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void **allEdgesDevice = reinterpret_cast(&(gpuModel->getAllEdgesDevice())); allocEdgeDeviceStruct(allEdgesDevice, Simulator::getInstance().getTotalVertices(), Simulator::getInstance().getMaxEdgesPerVertex()); } @@ -70,10 +70,11 @@ void AllDynamicSTDPSynapses::allocDeviceStruct( /// /// @param allEdgesDevice GPU address of the AllDynamicSTDPSynapsesDeviceProperties struct /// on device memory. -void AllDynamicSTDPSynapses::deleteEdgeDeviceStruct(void *allEdgesDevice) +void AllDynamicSTDPSynapses::deleteEdgeDeviceStruct() { AllDynamicSTDPSynapsesDeviceProperties allEdges; - + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allEdgesDevice = static_cast(gpuModel->getAllEdgesDevice()); HANDLE_ERROR(cudaMemcpy(&allEdges, allEdgesDevice, sizeof(AllDynamicSTDPSynapsesDeviceProperties), cudaMemcpyDeviceToHost)); @@ -102,10 +103,10 @@ void AllDynamicSTDPSynapses::deleteDeviceStruct( /// Copy all synapses' data from host to device. /// -/// @param allEdgesDevice GPU address of the AllDynamicSTDPSynapsesDeviceProperties struct -/// on device memory. -void AllDynamicSTDPSynapses::copyEdgeHostToDevice(void *allEdgesDevice) +void AllDynamicSTDPSynapses::copyEdgeHostToDevice() { // copy everything necessary + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allEdgesDevice = static_cast(gpuModel->getAllEdgesDevice()); copyEdgeHostToDevice(allEdgesDevice, Simulator::getInstance().getTotalVertices(), Simulator::getInstance().getMaxEdgesPerVertex()); } @@ -159,13 +160,12 @@ void AllDynamicSTDPSynapses::copyHostToDevice( /// Copy all synapses' data from device to host. /// -/// @param allEdgesDevice GPU address of the AllDynamicSTDPSynapsesDeviceProperties struct -/// on device memory. -void AllDynamicSTDPSynapses::copyEdgeDeviceToHost(void *allEdgesDevice) +void AllDynamicSTDPSynapses::copyEdgeDeviceToHost() { // copy everything necessary AllDynamicSTDPSynapsesDeviceProperties allEdges; - + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allEdgesDevice = static_cast(gpuModel->getAllEdgesDevice()); HANDLE_ERROR(cudaMemcpy(&allEdges, allEdgesDevice, sizeof(AllDynamicSTDPSynapsesDeviceProperties), cudaMemcpyDeviceToHost)); @@ -380,7 +380,8 @@ void AllDynamicSTDPSynapses::printGPUEdgesProps(void *allEdgesDeviceProps) const } for (int i = 0; i < countVertices_; i++) { - cout << "GPU edge_counts:" << "neuron[" << i << "]" << synapseCountsPrint[i] << endl; + cout << "GPU edge_counts:" + << "neuron[" << i << "]" << synapseCountsPrint[i] << endl; } cout << "GPU totalSynapseCount:" << totalSynapseCountPrint << endl; diff --git a/Simulator/Edges/Neuro/AllNeuroEdges.cpp b/Simulator/Edges/Neuro/AllNeuroEdges.cpp index 5596bb840..e36464d51 100644 --- a/Simulator/Edges/Neuro/AllNeuroEdges.cpp +++ b/Simulator/Edges/Neuro/AllNeuroEdges.cpp @@ -114,7 +114,8 @@ void AllNeuroEdges::printSynapsesProps() const } for (int i = 0; i < countVertices_; i++) { - cout << "edge_counts:" << "vertex[" << i << "]" << edgeCounts_[i] << endl; + cout << "edge_counts:" + << "vertex[" << i << "]" << edgeCounts_[i] << endl; } cout << "totalEdgeCount:" << totalEdgeCount_ << endl; diff --git a/Simulator/Edges/Neuro/AllSTDPSynapses.cpp b/Simulator/Edges/Neuro/AllSTDPSynapses.cpp index 1f227a35a..5c491ec0f 100644 --- a/Simulator/Edges/Neuro/AllSTDPSynapses.cpp +++ b/Simulator/Edges/Neuro/AllSTDPSynapses.cpp @@ -118,18 +118,29 @@ void AllSTDPSynapses::printParameters() const { AllSpikingSynapses::printParameters(); - LOG4CPLUS_DEBUG( - edgeLogger_, - "\n\t---AllSTDPSynapses Parameters---" - << "\n\tEdges type: AllSTDPSynapses \n\n" - << "\tSTDP gap" << defaultSTDPgap_ << "\n\n\tTauspost value: [" << " I: " << tauspost_I_ - << ", " << " E: " << tauspost_E_ << "]" << "\n\n\tTauspre value: [" << " I: " << tauspre_I_ - << ", " << " E: " << tauspre_E_ << "]" << "\n\n\tTaupos value: [" << " I: " << taupos_I_ - << ", " << " E: " << taupos_E_ << "]" << "\n\n\tTau negvalue: [" << " I: " << tauneg_I_ - << ", " << " E: " << tauneg_E_ << "]" << "\n\n\tWex value: [" << " I: " << Wex_I_ << ", " - << " E: " << Wex_E_ << "]" << "\n\n\tAneg value: [" << " I: " << Aneg_I_ << ", " - << " E: " << Aneg_E_ << "]" << "\n\n\tApos value: [" << " I: " << Apos_I_ << ", " - << " E: " << Apos_E_ << "]" << endl); + LOG4CPLUS_DEBUG(edgeLogger_, "\n\t---AllSTDPSynapses Parameters---" + << "\n\tEdges type: AllSTDPSynapses \n\n" + << "\tSTDP gap" << defaultSTDPgap_ << "\n\n\tTauspost value: [" + << " I: " << tauspost_I_ << ", " + << " E: " << tauspost_E_ << "]" + << "\n\n\tTauspre value: [" + << " I: " << tauspre_I_ << ", " + << " E: " << tauspre_E_ << "]" + << "\n\n\tTaupos value: [" + << " I: " << taupos_I_ << ", " + << " E: " << taupos_E_ << "]" + << "\n\n\tTau negvalue: [" + << " I: " << tauneg_I_ << ", " + << " E: " << tauneg_E_ << "]" + << "\n\n\tWex value: [" + << " I: " << Wex_I_ << ", " + << " E: " << Wex_E_ << "]" + << "\n\n\tAneg value: [" + << " I: " << Aneg_I_ << ", " + << " E: " << Aneg_E_ << "]" + << "\n\n\tApos value: [" + << " I: " << Apos_I_ << ", " + << " E: " << Apos_E_ << "]" << endl); } /// Sets the data for Synapse to input's data. diff --git a/Simulator/Edges/Neuro/AllSTDPSynapses.h b/Simulator/Edges/Neuro/AllSTDPSynapses.h index 7d7ea0660..1c8b59558 100644 --- a/Simulator/Edges/Neuro/AllSTDPSynapses.h +++ b/Simulator/Edges/Neuro/AllSTDPSynapses.h @@ -154,9 +154,7 @@ class AllSTDPSynapses : public AllSpikingSynapses { public: /// Allocate GPU memories to store all synapses' states, /// and copy them from host to GPU memory. - /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void allocEdgeDeviceStruct(void **allEdgesDevice) override; + virtual void allocEdgeDeviceStruct() override; /// Allocate GPU memories to store all synapses' states, /// and copy them from host to GPU memory. @@ -169,13 +167,10 @@ class AllSTDPSynapses : public AllSpikingSynapses { /// Delete GPU memories. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void deleteEdgeDeviceStruct(void *allEdgesDevice) override; + virtual void deleteEdgeDeviceStruct() override; /// Copy all synapses' data from host to device. - /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void copyEdgeHostToDevice(void *allEdgesDevice) override; + virtual void copyEdgeHostToDevice() override; /// Copy all synapses' data from host to device. /// @@ -187,8 +182,7 @@ class AllSTDPSynapses : public AllSpikingSynapses { /// Copy all synapses' data from device to host. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void copyEdgeDeviceToHost(void *allEdgesDevice) override; + virtual void copyEdgeDeviceToHost() override; /// Advance all the Synapses in the simulation. /// Update the state of all synapses for a time step. diff --git a/Simulator/Edges/Neuro/AllSTDPSynapses_d.cpp b/Simulator/Edges/Neuro/AllSTDPSynapses_d.cpp index 9527d87c2..0a66875af 100644 --- a/Simulator/Edges/Neuro/AllSTDPSynapses_d.cpp +++ b/Simulator/Edges/Neuro/AllSTDPSynapses_d.cpp @@ -32,11 +32,10 @@ __global__ void advanceSTDPSynapsesDevice(int totalSynapseCount, int maxSpikes); /// Allocate GPU memories to store all synapses' states, /// and copy them from host to GPU memory. -/// -/// @param allEdgesDevice GPU address of the AllSTDPSynapsesDeviceProperties struct -/// on device memory. -void AllSTDPSynapses::allocEdgeDeviceStruct(void **allEdgesDevice) +void AllSTDPSynapses::allocEdgeDeviceStruct() { + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void **allEdgesDevice = reinterpret_cast(&(gpuModel->getAllEdgesDevice())); allocEdgeDeviceStruct(allEdgesDevice, Simulator::getInstance().getTotalVertices(), Simulator::getInstance().getMaxEdgesPerVertex()); } @@ -93,11 +92,11 @@ void AllSTDPSynapses::allocDeviceStruct(AllSTDPSynapsesDeviceProperties &allEdge /// Delete GPU memories. /// -/// @param allEdgesDevice GPU address of the AllSTDPSynapsesDeviceProperties struct -/// on device memory. -void AllSTDPSynapses::deleteEdgeDeviceStruct(void *allEdgesDevice) +void AllSTDPSynapses::deleteEdgeDeviceStruct() { AllSTDPSynapsesDeviceProperties allEdgesDeviceProps; + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allEdgesDevice = static_cast(gpuModel->getAllEdgesDevice()); HANDLE_ERROR(cudaMemcpy(&allEdgesDeviceProps, allEdgesDevice, sizeof(AllSTDPSynapsesDeviceProperties), cudaMemcpyDeviceToHost)); deleteDeviceStruct(allEdgesDeviceProps); @@ -129,12 +128,10 @@ void AllSTDPSynapses::deleteDeviceStruct(AllSTDPSynapsesDeviceProperties &allEdg /// Copy all synapses' data from host to device. /// -/// @param allEdgesDevice GPU address of the AllSTDPSynapsesDeviceProperties struct -/// on device memory. -/// @param numVertices Number of vertices. -/// @param maxEdgesPerVertex Maximum number of synapses per neuron. -void AllSTDPSynapses::copyEdgeHostToDevice(void *allEdgesDevice) +void AllSTDPSynapses::copyEdgeHostToDevice() { // copy everything necessary + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allEdgesDevice = static_cast(gpuModel->getAllEdgesDevice()); copyEdgeHostToDevice(allEdgesDevice, Simulator::getInstance().getTotalVertices(), Simulator::getInstance().getMaxEdgesPerVertex()); } @@ -200,13 +197,12 @@ void AllSTDPSynapses::copyHostToDevice(void *allEdgesDevice, /// Copy all synapses' data from device to host. /// -/// @param allEdgesDevice GPU address of the AllSTDPSynapsesDeviceProperties struct -/// on device memory. -void AllSTDPSynapses::copyEdgeDeviceToHost(void *allEdgesDevice) +void AllSTDPSynapses::copyEdgeDeviceToHost() { // copy everything necessary AllSTDPSynapsesDeviceProperties allEdgesDeviceProps; - + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allEdgesDevice = static_cast(gpuModel->getAllEdgesDevice()); HANDLE_ERROR(cudaMemcpy(&allEdgesDeviceProps, allEdgesDevice, sizeof(AllSTDPSynapsesDeviceProperties), cudaMemcpyDeviceToHost)); copyDeviceToHost(allEdgesDeviceProps); @@ -409,7 +405,8 @@ void AllSTDPSynapses::printGPUEdgesProps(void *allEdgesDeviceProps) const } } for (int i = 0; i < countVertices_; i++) { - cout << "GPU edge_counts:" << "neuron[" << i << "]" << synapseCountsPrint[i] << endl; + cout << "GPU edge_counts:" + << "neuron[" << i << "]" << synapseCountsPrint[i] << endl; } cout << "GPU totalSynapseCount:" << totalSynapseCountPrint << endl; cout << "GPU maxEdgesPerVertex:" << maxEdgesPerVertexPrint << endl; diff --git a/Simulator/Edges/Neuro/AllSpikingSynapses.cpp b/Simulator/Edges/Neuro/AllSpikingSynapses.cpp index 0c7b54bb3..a9cfe63fa 100644 --- a/Simulator/Edges/Neuro/AllSpikingSynapses.cpp +++ b/Simulator/Edges/Neuro/AllSpikingSynapses.cpp @@ -107,14 +107,17 @@ void AllSpikingSynapses::printParameters() const << endl << "\tEdges type: AllSpikingSynapses" << endl << endl); - LOG4CPLUS_DEBUG(edgeLogger_, "\n\tTau values: [" << " II: " << tau_II_ << "," << " IE: " - << tau_IE_ << "," << " EI: " << tau_EI_ << "," - << " EE: " << tau_EE_ << "]" << endl); + LOG4CPLUS_DEBUG(edgeLogger_, "\n\tTau values: [" + << " II: " << tau_II_ << "," + << " IE: " << tau_IE_ << "," + << " EI: " << tau_EI_ << "," + << " EE: " << tau_EE_ << "]" << endl); LOG4CPLUS_DEBUG(edgeLogger_, "\n\tDelay values: [" - << " II: " << delay_II_ << "," << " IE: " << delay_IE_ << "," - << " EI:" << delay_EI_ << "," << " EE: " << delay_EE_ << "]" - << endl); + << " II: " << delay_II_ << "," + << " IE: " << delay_IE_ << "," + << " EI:" << delay_EI_ << "," + << " EE: " << delay_EE_ << "]" << endl); } /// Sets the data for Synapse to input's data. diff --git a/Simulator/Edges/Neuro/AllSpikingSynapses.h b/Simulator/Edges/Neuro/AllSpikingSynapses.h index 0cd04821b..f926c519d 100644 --- a/Simulator/Edges/Neuro/AllSpikingSynapses.h +++ b/Simulator/Edges/Neuro/AllSpikingSynapses.h @@ -122,9 +122,7 @@ class AllSpikingSynapses : public AllNeuroEdges { public: /// Allocate GPU memories to store all synapses' states, /// and copy them from host to GPU memory. - /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void allocEdgeDeviceStruct(void **allEdgesDevice) override; + virtual void allocEdgeDeviceStruct() override; /// Allocate GPU memories to store all synapses' states, /// and copy them from host to GPU memory. @@ -137,13 +135,11 @@ class AllSpikingSynapses : public AllNeuroEdges { /// Delete GPU memories. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void deleteEdgeDeviceStruct(void *allEdgesDevice) override; + virtual void deleteEdgeDeviceStruct() override; /// Copy all synapses' data from host to device. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void copyEdgeHostToDevice(void *allEdgesDevice) override; + virtual void copyEdgeHostToDevice() override; /// Copy all synapses' data from host to device. /// @@ -155,8 +151,7 @@ class AllSpikingSynapses : public AllNeuroEdges { /// Copy all synapses' data from device to host. /// - /// @param allEdgesDevice GPU address of the allEdges struct on device memory. - virtual void copyEdgeDeviceToHost(void *allEdgesDevice) override; + virtual void copyEdgeDeviceToHost() override; /// Get edge_counts in AllNeuroEdges struct on device memory. /// diff --git a/Simulator/Edges/Neuro/AllSpikingSynapses_d.cpp b/Simulator/Edges/Neuro/AllSpikingSynapses_d.cpp index 94364e4a2..23c7c98cb 100644 --- a/Simulator/Edges/Neuro/AllSpikingSynapses_d.cpp +++ b/Simulator/Edges/Neuro/AllSpikingSynapses_d.cpp @@ -10,6 +10,8 @@ #include "AllSpikingSynapses.h" #include "AllSynapsesDeviceFuncs.h" #include "Book.h" +#include "GPUModel.h" +#include "Simulator.h" #include /// CUDA code for advancing spiking synapses. @@ -28,11 +30,10 @@ __global__ void advanceSpikingSynapsesDevice(int totalSynapseCount, /// Allocate GPU memories to store all synapses' states, /// and copy them from host to GPU memory. -/// -/// @param allEdgesDevice GPU address of the AllSpikingSynapsesDeviceProperties struct -/// on device memory. -void AllSpikingSynapses::allocEdgeDeviceStruct(void **allEdgesDevice) +void AllSpikingSynapses::allocEdgeDeviceStruct() { + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void **allEdgesDevice = reinterpret_cast(&(gpuModel->getAllEdgesDevice())); allocEdgeDeviceStruct(allEdgesDevice, Simulator::getInstance().getTotalVertices(), Simulator::getInstance().getMaxEdgesPerVertex()); } @@ -89,11 +90,11 @@ void AllSpikingSynapses::allocDeviceStruct(AllSpikingSynapsesDeviceProperties &a /// Delete GPU memories. /// -/// @param allEdgesDevice GPU address of the AllSpikingSynapsesDeviceProperties struct -/// on device memory. -void AllSpikingSynapses::deleteEdgeDeviceStruct(void *allEdgesDevice) +void AllSpikingSynapses::deleteEdgeDeviceStruct() { AllSpikingSynapsesDeviceProperties allEdges; + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allEdgesDevice = static_cast(gpuModel->getAllEdgesDevice()); HANDLE_ERROR(cudaMemcpy(&allEdges, allEdgesDevice, sizeof(AllSpikingSynapsesDeviceProperties), cudaMemcpyDeviceToHost)); deleteDeviceStruct(allEdges); @@ -127,10 +128,10 @@ void AllSpikingSynapses::deleteDeviceStruct(AllSpikingSynapsesDeviceProperties & /// Copy all synapses' data from host to device. /// -/// @param allEdgesDevice GPU address of the AllSpikingSynapsesDeviceProperties struct -/// on device memory. -void AllSpikingSynapses::copyEdgeHostToDevice(void *allEdgesDevice) +void AllSpikingSynapses::copyEdgeHostToDevice() { // copy everything necessary + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allEdgesDevice = static_cast(gpuModel->getAllEdgesDevice()); copyEdgeHostToDevice(allEdgesDevice, Simulator::getInstance().getTotalVertices(), Simulator::getInstance().getMaxEdgesPerVertex()); } @@ -200,12 +201,12 @@ void AllSpikingSynapses::copyHostToDevice(void *allEdgesDevice, /// Copy all synapses' data from device to host. /// -/// @param allEdgesDevice GPU address of the AllSpikingSynapsesDeviceProperties struct -/// on device memory. -void AllSpikingSynapses::copyEdgeDeviceToHost(void *allEdgesDevice) +void AllSpikingSynapses::copyEdgeDeviceToHost() { // copy everything necessary AllSpikingSynapsesDeviceProperties allEdges; + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allEdgesDevice = static_cast(gpuModel->getAllEdgesDevice()); HANDLE_ERROR(cudaMemcpy(&allEdges, allEdgesDevice, sizeof(AllSpikingSynapsesDeviceProperties), cudaMemcpyDeviceToHost)); copyDeviceToHost(allEdges); @@ -415,7 +416,8 @@ void AllSpikingSynapses::printGPUEdgesProps(void *allEdgesDeviceProps) const } } for (int i = 0; i < countVertices_; i++) { - cout << "GPU edge_counts:" << "neuron[" << i << "]" << synapseCountsPrint[i] << endl; + cout << "GPU edge_counts:" + << "neuron[" << i << "]" << synapseCountsPrint[i] << endl; } cout << "GPU totalSynapseCount:" << totalSynapseCountPrint << endl; cout << "GPU maxEdgesPerVertex:" << maxEdgesPerVertexPrint << endl; diff --git a/Simulator/Utils/Inputs/FSInput.cpp b/Simulator/Utils/Inputs/FSInput.cpp index 41dce1257..7d9e63c45 100644 --- a/Simulator/Utils/Inputs/FSInput.cpp +++ b/Simulator/Utils/Inputs/FSInput.cpp @@ -30,8 +30,8 @@ ISInput *FSInput::CreateInstance() // load stimulus input file TiXmlDocument siDoc(stimulusFileName.c_str()); if (!siDoc.LoadFile()) { - cerr << "Failed loading stimulus input file " << stimulusFileName << ":" << "\n\t" - << siDoc.ErrorDesc() << endl; + cerr << "Failed loading stimulus input file " << stimulusFileName << ":" + << "\n\t" << siDoc.ErrorDesc() << endl; cerr << " error: " << siDoc.ErrorRow() << ", " << siDoc.ErrorCol() << endl; return nullptr; } diff --git a/Simulator/Utils/Inputs/SInputPoisson.cpp b/Simulator/Utils/Inputs/SInputPoisson.cpp index 3878f7352..a9960da7c 100644 --- a/Simulator/Utils/Inputs/SInputPoisson.cpp +++ b/Simulator/Utils/Inputs/SInputPoisson.cpp @@ -67,7 +67,8 @@ SInputPoisson::SInputPoisson(TiXmlElement *parms) : TiXmlDocument simDoc(maskNListFileName.c_str()); if (!simDoc.LoadFile()) { cerr << "Failed loading positions of stimulus input mask neurons list file " - << maskNListFileName << ":" << "\n\t" << simDoc.ErrorDesc() << endl; + << maskNListFileName << ":" + << "\n\t" << simDoc.ErrorDesc() << endl; cerr << " error: " << simDoc.ErrorRow() << ", " << simDoc.ErrorCol() << endl; break; } diff --git a/Simulator/Vertices/AllVertices.cpp b/Simulator/Vertices/AllVertices.cpp index 107848c34..fbab0beaa 100644 --- a/Simulator/Vertices/AllVertices.cpp +++ b/Simulator/Vertices/AllVertices.cpp @@ -22,6 +22,30 @@ AllVertices::AllVertices() : size_(0) OperationManager::getInstance().registerOperation(Operations::printParameters, printParametersFunc); + // Register registerHistoryVariables function as a registerHistoryVariables operation in the OperationManager + function registerHistory = bind(&AllVertices::registerHistoryVariables, this); + OperationManager::getInstance().registerOperation(Operations::registerHistoryVariables, + registerHistory); + +#if defined(USE_GPU) + // Register allocNeuronDeviceStruct function as a allocateGPU operation in the OperationManager + function allocateGPU = bind(&AllVertices::allocVerticesDeviceStruct, this); + OperationManager::getInstance().registerOperation(Operations::allocateGPU, allocateGPU); + + // Register AllVertices::copyToDevice function as a copyToGPU operation in the OperationManager + function copyCPUtoGPU = bind(&AllVertices::copyToDevice, this); + OperationManager::getInstance().registerOperation(Operations::copyToGPU, copyCPUtoGPU); + + // Register copyFromGPU operation for transferring edge data from device to host + function copyFromGPU = bind(&AllVertices::copyFromDevice, this); + OperationManager::getInstance().registerOperation(Operations::copyFromGPU, copyFromGPU); + + // Register deleteNeuronDeviceStruct function as a deallocateGPUMemory operation in the OperationManager + function deallocateGPUMemory = bind(&AllVertices::deleteVerticesDeviceStruct, this); + OperationManager::getInstance().registerOperation(Operations::deallocateGPUMemory, + deallocateGPUMemory); +#endif + // Get a copy of the file and vertex logger to use log4cplus macros to print to debug files fileLogger_ = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("file")); vertexLogger_ = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("vertex")); diff --git a/Simulator/Vertices/AllVertices.h b/Simulator/Vertices/AllVertices.h index d005c689c..cecb91616 100644 --- a/Simulator/Vertices/AllVertices.h +++ b/Simulator/Vertices/AllVertices.h @@ -95,14 +95,11 @@ class AllVertices { public: /// Allocate GPU memories to store all vertices' states, /// and copy them from host to GPU memory. - /// - /// @param allVerticesDevice GPU address of the allVertices struct on device memory. - virtual void allocVerticesDeviceStruct(void **allVerticesDevice) = 0; + virtual void allocVerticesDeviceStruct() = 0; /// Delete GPU memories. /// - /// @param allVerticesDevice GPU address of the allVertices struct on device memory. - virtual void deleteVerticesDeviceStruct(void *allVerticesDevice) = 0; + virtual void deleteVerticesDeviceStruct() = 0; /// Clear the spike counts out of all vertices. // @@ -110,14 +107,11 @@ class AllVertices { virtual void clearVertexHistory(void *allVerticesDevice) = 0; /// Copy all vertices' data from host to device. - /// - /// @param allVerticesDevice GPU address of the allVertices struct on device memory. - virtual void copyToDevice(void *allVerticesDevice) = 0; + virtual void copyToDevice() = 0; /// Copy all vertices' data from device to host. /// - /// @param allVerticesDevice GPU address of the allVertices struct on device memory. - virtual void copyFromDevice(void *allVerticesDevice) = 0; + virtual void copyFromDevice() = 0; /// Update the state of all vertices for a time step /// Notify outgoing edges if vertex has fired. diff --git a/Simulator/Vertices/NG911/All911Vertices.h b/Simulator/Vertices/NG911/All911Vertices.h index 1a537437a..9e0903965 100644 --- a/Simulator/Vertices/NG911/All911Vertices.h +++ b/Simulator/Vertices/NG911/All911Vertices.h @@ -225,10 +225,10 @@ class All911Vertices : public AllVertices { // GPU functionality for 911 simulation is unimplemented. // These signatures are required to make the class non-abstract public: - virtual void allocVerticesDeviceStruct(void **allVerticesDevice) {}; - virtual void deleteVerticesDeviceStruct(void *allVerticesDevice) {}; - virtual void copyToDevice(void *allVerticesDevice) {}; - virtual void copyFromDevice(void *allVerticesDevice) {}; + virtual void allocVerticesDeviceStruct() {}; + virtual void deleteVerticesDeviceStruct() {}; + virtual void copyToDevice() {}; + virtual void copyFromDevice() {}; virtual void advanceVertices(AllEdges &edges, void *allVerticesDevice, void *allEdgesDevice, float randNoise[], EdgeIndexMapDevice *edgeIndexMapDevice) {}; virtual void setAdvanceVerticesDeviceParams(AllEdges &edges) {}; diff --git a/Simulator/Vertices/Neuro/AllIFNeurons.h b/Simulator/Vertices/Neuro/AllIFNeurons.h index b199dd32d..bd64734a3 100644 --- a/Simulator/Vertices/Neuro/AllIFNeurons.h +++ b/Simulator/Vertices/Neuro/AllIFNeurons.h @@ -88,25 +88,20 @@ class AllIFNeurons : public AllSpikingNeurons { /// Allocate GPU memories to store all neurons' states, /// and copy them from host to GPU memory. - /// - /// @param allVerticesDevice GPU address of the allNeurons struct on device memory. - virtual void allocVerticesDeviceStruct(void **allVerticesDevice); + virtual void allocVerticesDeviceStruct(); /// Delete GPU memories. /// - /// @param allVerticesDevice GPU address of the allNeurons struct on device memory. - virtual void deleteVerticesDeviceStruct(void *allVerticesDevice); + virtual void deleteVerticesDeviceStruct(); /// Clear the spike counts out of all neurons. // /// @param allVerticesDevice GPU address of the allNeurons struct on device memory. virtual void clearVertexHistory(void *allVerticesDevice) override; //Copy all neurons' data from device to host. - //@param allVerticesDevice GPU address of the allNeurons struct on device memory. - virtual void copyFromDevice(void *deviceAddress) override; + virtual void copyFromDevice() override; //Copy all neurons' data from host to device. - // @param allVerticesDevice GPU address of the allNeurons struct on device memory. - virtual void copyToDevice(void *deviceAddress) override; + virtual void copyToDevice() override; protected: /// Allocate GPU memories to store all neurons' states. diff --git a/Simulator/Vertices/Neuro/AllIFNeurons_d.cpp b/Simulator/Vertices/Neuro/AllIFNeurons_d.cpp index 572ff8b97..269c90ddc 100644 --- a/Simulator/Vertices/Neuro/AllIFNeurons_d.cpp +++ b/Simulator/Vertices/Neuro/AllIFNeurons_d.cpp @@ -8,14 +8,18 @@ #include "AllIFNeurons.h" #include "Book.h" +#include "GPUModel.h" +#include "Simulator.h" /// Allocate GPU memories to store all neurons' states, /// and copy them from host to GPU memory. /// /// @param allVerticesDevice GPU address of the AllIFNeuronsDeviceProperties struct on device memory. -void AllIFNeurons::allocVerticesDeviceStruct(void **allVerticesDevice) +void AllIFNeurons::allocVerticesDeviceStruct() { AllIFNeuronsDeviceProperties allNeurons; + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void **allVerticesDevice = reinterpret_cast(&(gpuModel->getAllVerticesDevice())); allocDeviceStruct(allNeurons); HANDLE_ERROR(cudaMalloc(allVerticesDevice, sizeof(AllIFNeuronsDeviceProperties))); HANDLE_ERROR(cudaMemcpy(*allVerticesDevice, &allNeurons, sizeof(AllIFNeuronsDeviceProperties), @@ -69,10 +73,11 @@ void AllIFNeurons::allocDeviceStruct(AllIFNeuronsDeviceProperties &allVerticesDe /// Delete GPU memories. /// -/// @param allVerticesDevice GPU address of the AllVerticesDeviceProperties struct on device memory. -void AllIFNeurons::deleteVerticesDeviceStruct(void *allVerticesDevice) +void AllIFNeurons::deleteVerticesDeviceStruct() { AllIFNeuronsDeviceProperties allVerticesDeviceProps; + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allVerticesDevice = static_cast(gpuModel->getAllVerticesDevice()); HANDLE_ERROR(cudaMemcpy(&allVerticesDeviceProps, allVerticesDevice, sizeof(AllIFNeuronsDeviceProperties), cudaMemcpyDeviceToHost)); deleteDeviceStruct(allVerticesDeviceProps); @@ -117,11 +122,11 @@ void AllIFNeurons::deleteDeviceStruct(AllIFNeuronsDeviceProperties &allVerticesD } /// Copy all neurons' data from host to device. -/// -/// @param allVerticesDevice GPU address of the AllIFNeuronsDeviceProperties struct on device memory. -void AllIFNeurons::copyToDevice(void *allVerticesDevice) +void AllIFNeurons::copyToDevice() { int count = Simulator::getInstance().getTotalVertices(); + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allVerticesDevice = static_cast(gpuModel->getAllVerticesDevice()); AllIFNeuronsDeviceProperties allVerticesDeviceProps; HANDLE_ERROR(cudaMemcpy(&allVerticesDeviceProps, allVerticesDevice, sizeof(AllIFNeuronsDeviceProperties), cudaMemcpyDeviceToHost)); @@ -158,15 +163,16 @@ void AllIFNeurons::copyToDevice(void *allVerticesDevice) HANDLE_ERROR(cudaMemcpy(allVerticesDeviceProps.numStepsInRefractoryPeriod_, numStepsInRefractoryPeriod_.data(), count * sizeof(int), cudaMemcpyHostToDevice)); - AllSpikingNeurons::copyToDevice(allVerticesDevice); + AllSpikingNeurons::copyToDevice(); } /// Copy all neurons' data from device to host. /// -/// @param allVerticesDevice GPU address of the AllIFNeuronsDeviceProperties struct on device memory. -void AllIFNeurons::copyFromDevice(void *allVerticesDevice) +void AllIFNeurons::copyFromDevice() { - AllSpikingNeurons::copyFromDevice(allVerticesDevice); + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allVerticesDevice = static_cast(gpuModel->getAllVerticesDevice()); + AllSpikingNeurons::copyFromDevice(); int count = Simulator::getInstance().getTotalVertices(); AllIFNeuronsDeviceProperties allVerticesDeviceProps; HANDLE_ERROR(cudaMemcpy(&allVerticesDeviceProps, allVerticesDevice, diff --git a/Simulator/Vertices/Neuro/AllIZHNeurons.h b/Simulator/Vertices/Neuro/AllIZHNeurons.h index ee1520790..a0c436584 100644 --- a/Simulator/Vertices/Neuro/AllIZHNeurons.h +++ b/Simulator/Vertices/Neuro/AllIZHNeurons.h @@ -138,14 +138,11 @@ class AllIZHNeurons : public AllIFNeurons { /// Allocate GPU memories to store all neurons' states, /// and copy them from host to GPU memory. - // - /// @param allVerticesDevice GPU address of the allNeurons struct on device memory. - virtual void allocVerticesDeviceStruct(void **allVerticesDevice) override; + virtual void allocVerticesDeviceStruct() override; /// Delete GPU memories. // - /// @param allVerticesDevice GPU address of the allNeurons struct on device memory. - virtual void deleteVerticesDeviceStruct(void *allVerticesDevice) override; + virtual void deleteVerticesDeviceStruct() override; /// Copy spike history data stored in device memory to host. // @@ -164,13 +161,10 @@ class AllIZHNeurons : public AllIFNeurons { // Copy all neurons' data from device to host. // - /// @param allVerticesDevice GPU address of the allNeurons struct on device memory. - virtual void copyFromDevice(void *deviceAddress) override; + virtual void copyFromDevice() override; // Copy all neurons' data from host to device. - // - /// @param allVerticesDevice GPU address of the allNeurons struct on device memory. - virtual void copyToDevice(void *deviceAddress) override; + virtual void copyToDevice() override; protected: diff --git a/Simulator/Vertices/Neuro/AllIZHNeurons_d.cpp b/Simulator/Vertices/Neuro/AllIZHNeurons_d.cpp index 2e0c8d2a6..0244a629e 100644 --- a/Simulator/Vertices/Neuro/AllIZHNeurons_d.cpp +++ b/Simulator/Vertices/Neuro/AllIZHNeurons_d.cpp @@ -10,7 +10,8 @@ #include "AllSpikingSynapses.h" #include "AllVerticesDeviceFuncs.h" #include "Book.h" - +#include "GPUModel.h" +#include "Simulator.h" /// CUDA code for advancing izhikevich neurons /// @@ -36,12 +37,11 @@ __global__ void advanceIZHNeuronsDevice(int totalVertices, int maxEdges, int max /// Allocate GPU memories to store all neurons' states, /// and copy them from host to GPU memory. /// -/// @param allVerticesDevice GPU address of the AllIZHNeuronsDeviceProperties struct -/// on device memory. -void AllIZHNeurons::allocVerticesDeviceStruct(void **allVerticesDevice) +void AllIZHNeurons::allocVerticesDeviceStruct() { AllIZHNeuronsDeviceProperties allVerticesDeviceProps; - + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void **allVerticesDevice = reinterpret_cast(&(gpuModel->getAllVerticesDevice())); allocDeviceStruct(allVerticesDeviceProps); HANDLE_ERROR(cudaMalloc(allVerticesDevice, sizeof(AllIZHNeuronsDeviceProperties))); @@ -69,12 +69,11 @@ void AllIZHNeurons::allocDeviceStruct(AllIZHNeuronsDeviceProperties &allVertices /// Delete GPU memories. /// -/// @param allVerticesDevice GPU address of the AllVerticesDeviceProperties struct -/// on device memory. -void AllIZHNeurons::deleteVerticesDeviceStruct(void *allVerticesDevice) +void AllIZHNeurons::deleteVerticesDeviceStruct() { AllIZHNeuronsDeviceProperties allVerticesDeviceProps; - + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allVerticesDevice = static_cast(gpuModel->getAllVerticesDevice()); HANDLE_ERROR(cudaMemcpy(&allVerticesDeviceProps, allVerticesDevice, sizeof(AllIZHNeuronsDeviceProperties), cudaMemcpyDeviceToHost)); @@ -101,18 +100,17 @@ void AllIZHNeurons::deleteDeviceStruct(AllIZHNeuronsDeviceProperties &allVertice /// Copy all neurons' data from host to device. /// -/// @param allVerticesDevice GPU address of the AllIZHNeuronsDeviceProperties struct -/// on device memory. -void AllIZHNeurons::copyToDevice(void *allVerticesDevice) +void AllIZHNeurons::copyToDevice() { AllIZHNeuronsDeviceProperties allVerticesDeviceProps; - + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allVerticesDevice = static_cast(gpuModel->getAllVerticesDevice()); HANDLE_ERROR(cudaMemcpy(&allVerticesDeviceProps, allVerticesDevice, sizeof(AllIZHNeuronsDeviceProperties), cudaMemcpyDeviceToHost)); int count = Simulator::getInstance().getTotalVertices(); - AllIFNeurons::copyToDevice(allVerticesDevice); + AllIFNeurons::copyToDevice(); HANDLE_ERROR(cudaMemcpy(allVerticesDeviceProps.Aconst_, Aconst_.data(), count * sizeof(BGFLOAT), cudaMemcpyHostToDevice)); @@ -130,11 +128,11 @@ void AllIZHNeurons::copyToDevice(void *allVerticesDevice) /// Copy all neurons' data from device to host. /// -/// @param allVerticesDevice GPU address of the AllIZHNeuronsDeviceProperties struct -/// on device memory. -void AllIZHNeurons::copyFromDevice(void *allVerticesDevice) +void AllIZHNeurons::copyFromDevice() { - AllIFNeurons::copyFromDevice(allVerticesDevice); + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *allVerticesDevice = static_cast(gpuModel->getAllVerticesDevice()); + AllIFNeurons::copyFromDevice(); AllIZHNeuronsDeviceProperties allVerticesDeviceProps; HANDLE_ERROR(cudaMemcpy(&allVerticesDeviceProps, allVerticesDevice, diff --git a/Simulator/Vertices/Neuro/AllSpikingNeurons.h b/Simulator/Vertices/Neuro/AllSpikingNeurons.h index 675370a26..0790f6f23 100644 --- a/Simulator/Vertices/Neuro/AllSpikingNeurons.h +++ b/Simulator/Vertices/Neuro/AllSpikingNeurons.h @@ -62,6 +62,8 @@ class AllSpikingNeurons : public AllVertices { /// @param synapses Reference to the allEdges struct on host memory. virtual void setAdvanceVerticesDeviceParams(AllEdges &synapses); + virtual void copyFromDevice() override; + virtual void copyToDevice() override; /// Add psr of all incoming synapses to summation points. /// /// @param allVerticesDevice GPU address of the allVertices struct on device memory. @@ -70,9 +72,6 @@ class AllSpikingNeurons : public AllVertices { virtual void integrateVertexInputs(void *allVerticesDevice, EdgeIndexMapDevice *edgeIndexMapDevice, void *allEdgesDevice); - virtual void copyFromDevice(void *deviceAddress) override; - virtual void copyToDevice(void *deviceAddress) override; - protected: /// Clear the spike counts out of all neurons in device memory. /// (helper function of clearNeuronSpikeCounts) diff --git a/Simulator/Vertices/Neuro/AllSpikingNeurons_d.cpp b/Simulator/Vertices/Neuro/AllSpikingNeurons_d.cpp index 1fbc9f492..d1018825c 100644 --- a/Simulator/Vertices/Neuro/AllSpikingNeurons_d.cpp +++ b/Simulator/Vertices/Neuro/AllSpikingNeurons_d.cpp @@ -9,6 +9,8 @@ #include "AllSpikingNeurons.h" #include "AllSpikingSynapses.h" #include "Book.h" +#include "GPUModel.h" +#include "Simulator.h" /// CUDA kernel for adding psr of all incoming synapses to summation points. /// @@ -32,9 +34,11 @@ __global__ void calcSummationPointDevice(int totalVertices, EdgeIndexMapDevice *edgeIndexMapDevice, AllSpikingSynapsesDeviceProperties *allEdgesDevice); -void AllSpikingNeurons::copyToDevice(void *deviceAddress) +void AllSpikingNeurons::copyToDevice() { AllSpikingNeuronsDeviceProperties allVerticesDevice; + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *deviceAddress = static_cast(gpuModel->getAllVerticesDevice()); HANDLE_ERROR(cudaMemcpy(&allVerticesDevice, deviceAddress, sizeof(AllSpikingNeuronsDeviceProperties), cudaMemcpyDeviceToHost)); @@ -88,8 +92,10 @@ void AllSpikingNeurons::copyToDevice(void *deviceAddress) HANDLE_ERROR(cudaMemcpy(allVerticesDevice.summationPoints_, summationPoints_.data(), count * sizeof(BGFLOAT), cudaMemcpyHostToDevice)); } -void AllSpikingNeurons::copyFromDevice(void *deviceAddress) +void AllSpikingNeurons::copyFromDevice() { + GPUModel *gpuModel = static_cast(&Simulator::getInstance().getModel()); + void *deviceAddress = static_cast(gpuModel->getAllVerticesDevice()); int numVertices = Simulator::getInstance().getTotalVertices(); AllSpikingNeuronsDeviceProperties allVerticesDevice; diff --git a/Testing/UnitTesting/XmlRecorderTests.cpp b/Testing/UnitTesting/XmlRecorderTests.cpp index 1a39bab12..8f9bb1d66 100644 --- a/Testing/UnitTesting/XmlRecorderTests.cpp +++ b/Testing/UnitTesting/XmlRecorderTests.cpp @@ -199,7 +199,9 @@ TEST(XmlRecorderTest, ToXML) // Verify the expected XML output stringstream os; os << "" << endl; os << " "; diff --git a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-actions.h b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-actions.h index 4a154b078..437dc3933 100644 --- a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-actions.h +++ b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-actions.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // The ACTION* family of macros can be used in a namespace scope to @@ -131,7 +130,7 @@ #define GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ #ifndef _WIN32_WCE -# include +#include #endif #include @@ -147,8 +146,8 @@ #include "gmock/internal/gmock-pp.h" #ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) +#pragma warning(push) +#pragma warning(disable : 4100) #endif namespace testing { @@ -196,9 +195,7 @@ class BuiltInDefaultValue { public: // This function returns true if and only if type T has a built-in default // value. - static bool Exists() { - return ::std::is_default_constructible::value; - } + static bool Exists() { return ::std::is_default_constructible::value; } static T Get() { return BuiltInDefaultValueGetter< @@ -227,11 +224,11 @@ class BuiltInDefaultValue { // The following specializations define the default values for // specific types we care about. #define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \ - template <> \ - class BuiltInDefaultValue { \ - public: \ - static bool Exists() { return true; } \ - static type Get() { return value; } \ + template <> \ + class BuiltInDefaultValue { \ + public: \ + static bool Exists() { return true; } \ + static type Get() { return value; } \ } GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, ); // NOLINT @@ -255,10 +252,10 @@ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U); // NOLINT GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0); // NOLINT GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U); GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); // NOLINT GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long long, 0); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long long, 0); // NOLINT +GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long long, 0); // NOLINT GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0); GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0); @@ -838,7 +835,7 @@ class ReturnRoundRobinAction { template T operator()(Args&&...) const { - return state_->Next(); + return state_->Next(); } private: @@ -861,7 +858,9 @@ class DoDefaultAction { // This template type conversion operator allows DoDefault() to be // used in any function. template - operator Action() const { return Action(); } // NOLINT + operator Action() const { + return Action(); + } // NOLINT }; // Implements the Assign action to set a given pointer referent to a @@ -889,8 +888,7 @@ template class SetErrnoAndReturnAction { public: SetErrnoAndReturnAction(int errno_value, T result) - : errno_(errno_value), - result_(result) {} + : errno_(errno_value), result_(result) {} template Result Perform(const ArgumentTuple& /* args */) const { errno = errno_; @@ -1001,8 +999,8 @@ class IgnoreResultAction { private: // Type OriginalFunction is the same as F except that its return // type is IgnoredValue. - typedef typename internal::Function::MakeResultIgnoredValue - OriginalFunction; + typedef + typename internal::Function::MakeResultIgnoredValue OriginalFunction; const Action action_; }; @@ -1019,12 +1017,12 @@ struct WithArgsAction { template operator Action() const { // NOLINT using TupleType = std::tuple; - Action::type...)> - converted(action); + Action::type...)> converted( + action); return [converted](Args... args) -> R { return converted.Perform(std::forward_as_tuple( - std::get(std::forward_as_tuple(std::forward(args)...))...)); + std::get(std::forward_as_tuple(std::forward(args)...))...)); }; } }; @@ -1106,8 +1104,8 @@ internal::DoAllAction::type...> DoAll( // multiple arguments. For convenience, we also provide // WithArgs(an_action) (defined below) as a synonym. template -internal::WithArgsAction::type, k> -WithArg(InnerAction&& action) { +internal::WithArgsAction::type, k> WithArg( + InnerAction&& action) { return {std::forward(action)}; } @@ -1126,8 +1124,8 @@ WithArgs(InnerAction&& action) { // argument. In other words, it adapts an action accepting no // argument to one that accepts (and ignores) arguments. template -internal::WithArgsAction::type> -WithoutArgs(InnerAction&& action) { +internal::WithArgsAction::type> WithoutArgs( + InnerAction&& action) { return {std::forward(action)}; } @@ -1213,7 +1211,7 @@ internal::SetArgumentPointeeAction SetArgumentPointee(T value) { // Creates an action that sets a pointer referent to a given value. template -PolymorphicAction > Assign(T1* ptr, T2 val) { +PolymorphicAction> Assign(T1* ptr, T2 val) { return MakePolymorphicAction(internal::AssignAction(ptr, val)); } @@ -1221,8 +1219,8 @@ PolymorphicAction > Assign(T1* ptr, T2 val) { // Creates an action that sets errno and returns the appropriate error. template -PolymorphicAction > -SetErrnoAndReturn(int errval, T result) { +PolymorphicAction> SetErrnoAndReturn( + int errval, T result) { return MakePolymorphicAction( internal::SetErrnoAndReturnAction(errval, result)); } @@ -1483,9 +1481,8 @@ auto InvokeArgumentAdl(AdlTag, F f, Args... args) -> decltype(f(args...)) { template \ template \ typename ::testing::internal::Function::Result \ - full_name::gmock_Impl< \ - F>::gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) \ - const + full_name::gmock_Impl< \ + F>::gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const } // namespace internal @@ -1552,8 +1549,7 @@ auto InvokeArgumentAdl(AdlTag, F f, Args... args) -> decltype(f(args...)) { } // namespace testing #ifdef _MSC_VER -# pragma warning(pop) +#pragma warning(pop) #endif - #endif // GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ diff --git a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-cardinalities.h b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-cardinalities.h index 46e01e102..a076734f7 100644 --- a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-cardinalities.h +++ b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-cardinalities.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // This file implements some commonly used cardinalities. More @@ -40,8 +39,10 @@ #define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ #include + #include #include // NOLINT + #include "gmock/internal/gmock-port.h" #include "gtest/gtest.h" @@ -116,7 +117,7 @@ class GTEST_API_ Cardinality { // cardinality, i.e. exceed the maximum number of allowed calls. bool IsOverSaturatedByCallCount(int call_count) const { return impl_->IsSaturatedByCallCount(call_count) && - !impl_->IsSatisfiedByCallCount(call_count); + !impl_->IsSatisfiedByCallCount(call_count); } // Describes self to an ostream diff --git a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-function-mocker.h b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-function-mocker.h index 317d6c2b7..729e54074 100644 --- a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-function-mocker.h +++ b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-function-mocker.h @@ -136,8 +136,9 @@ using internal::FunctionMocker; _Signature)>::Result \ GMOCK_INTERNAL_EXPAND(_CallType) \ _MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \ - GMOCK_PP_IF(_Constness, const, ) _NoexceptSpec \ - GMOCK_PP_IF(_Override, override, ) GMOCK_PP_IF(_Final, final, ) { \ + GMOCK_PP_IF(_Constness, const, ) \ + _NoexceptSpec GMOCK_PP_IF(_Override, override, ) \ + GMOCK_PP_IF(_Final, final, ) { \ GMOCK_MOCKER_(_N, _Constness, _MethodName) \ .SetOwnerAndName(this, #_MethodName); \ return GMOCK_MOCKER_(_N, _Constness, _MethodName) \ @@ -160,7 +161,7 @@ using internal::FunctionMocker; GMOCK_INTERNAL_A_MATCHER_ARGUMENT, _Signature, _N)); \ } \ mutable ::testing::FunctionMocker \ - GMOCK_MOCKER_(_N, _Constness, _MethodName) + GMOCK_MOCKER_(_N, _Constness, _MethodName) #define GMOCK_INTERNAL_EXPAND(...) __VA_ARGS__ diff --git a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-generated-actions.h b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-generated-actions.h index 7030a98e9..bc63df4a3 100644 --- a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-generated-actions.h +++ b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-generated-actions.h @@ -31,7 +31,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // This file implements some commonly used variadic actions. @@ -47,7 +46,6 @@ #include "gmock/gmock-actions.h" #include "gmock/internal/gmock-port.h" - // Sometimes you want to give an action explicit template parameters // that cannot be inferred from its value parameters. ACTION() and // ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that @@ -131,194 +129,272 @@ // Declares the template parameters. #define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0 -#define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ - name1) kind0 name0, kind1 name1 +#define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, name1) \ + kind0 name0, kind1 name1 #define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2) kind0 name0, kind1 name1, kind2 name2 + kind2, name2) \ + kind0 name0, kind1 name1, kind2 name2 #define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \ - kind3 name3 -#define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \ - kind2 name2, kind3 name3, kind4 name4 + kind2, name2, kind3, name3) \ + kind0 name0, kind1 name1, kind2 name2, kind3 name3 +#define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS( \ + kind0, name0, kind1, name1, kind2, name2, kind3, name3, kind4, name4) \ + kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4 #define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \ - kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5 -#define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ - name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \ - kind5 name5, kind6 name6 -#define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ - kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \ - kind4 name4, kind5 name5, kind6 name6, kind7 name7 -#define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ - kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \ - kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \ - kind8 name8 -#define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ - name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ - name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \ - kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \ - kind6 name6, kind7 name7, kind8 name8, kind9 name9 + kind2, name2, kind3, name3, \ + kind4, name4, kind5, name5) \ + kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5 +#define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS( \ + kind0, name0, kind1, name1, kind2, name2, kind3, name3, kind4, name4, \ + kind5, name5, kind6, name6) \ + kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \ + kind5 name5, kind6 name6 +#define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS( \ + kind0, name0, kind1, name1, kind2, name2, kind3, name3, kind4, name4, \ + kind5, name5, kind6, name6, kind7, name7) \ + kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \ + kind5 name5, kind6 name6, kind7 name7 +#define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS( \ + kind0, name0, kind1, name1, kind2, name2, kind3, name3, kind4, name4, \ + kind5, name5, kind6, name6, kind7, name7, kind8, name8) \ + kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \ + kind5 name5, kind6 name6, kind7 name7, kind8 name8 +#define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS( \ + kind0, name0, kind1, name1, kind2, name2, kind3, name3, kind4, name4, \ + kind5, name5, kind6, name6, kind7, name7, kind8, name8, kind9, name9) \ + kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \ + kind5 name5, kind6 name6, kind7 name7, kind8 name8, kind9 name9 // Lists the template parameters. #define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0 -#define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ - name1) name0, name1 +#define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, name1) \ + name0, name1 #define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2) name0, name1, name2 + kind2, name2) \ + name0, name1, name2 #define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3) name0, name1, name2, name3 -#define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \ - name4 + kind2, name2, kind3, name3) \ + name0, name1, name2, name3 +#define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS( \ + kind0, name0, kind1, name1, kind2, name2, kind3, name3, kind4, name4) \ + name0, name1, name2, name3, name4 #define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \ - name2, name3, name4, name5 -#define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ - name6) name0, name1, name2, name3, name4, name5, name6 -#define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ - kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7 -#define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ - kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \ - name6, name7, name8 -#define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ - name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ - name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \ - name3, name4, name5, name6, name7, name8, name9 + kind2, name2, kind3, name3, \ + kind4, name4, kind5, name5) \ + name0, name1, name2, name3, name4, name5 +#define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS( \ + kind0, name0, kind1, name1, kind2, name2, kind3, name3, kind4, name4, \ + kind5, name5, kind6, name6) \ + name0, name1, name2, name3, name4, name5, name6 +#define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS( \ + kind0, name0, kind1, name1, kind2, name2, kind3, name3, kind4, name4, \ + kind5, name5, kind6, name6, kind7, name7) \ + name0, name1, name2, name3, name4, name5, name6, name7 +#define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS( \ + kind0, name0, kind1, name1, kind2, name2, kind3, name3, kind4, name4, \ + kind5, name5, kind6, name6, kind7, name7, kind8, name8) \ + name0, name1, name2, name3, name4, name5, name6, name7, name8 +#define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS( \ + kind0, name0, kind1, name1, kind2, name2, kind3, name3, kind4, name4, \ + kind5, name5, kind6, name6, kind7, name7, kind8, name8, kind9, name9) \ + name0, name1, name2, name3, name4, name5, name6, name7, name8, name9 // Declares the types of value parameters. #define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS() #define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \ - typename p0##_type, typename p1##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \ - typename p0##_type, typename p1##_type, typename p2##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ - typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ - typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ - typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) \ + , typename p0##_type, typename p1##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) \ + , typename p0##_type, typename p1##_type, typename p2##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) \ + , typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) \ + , typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type, typename p4##_type +#define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) \ + , typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type, typename p4##_type, typename p5##_type #define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) , typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type + p6) \ + , typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type, typename p4##_type, typename p5##_type, \ + typename p6##_type #define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type + p6, p7) \ + , typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type, typename p4##_type, typename p5##_type, \ + typename p6##_type, typename p7##_type #define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type + p6, p7, p8) \ + , typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type, typename p4##_type, typename p5##_type, \ + typename p6##_type, typename p7##_type, typename p8##_type #define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \ - typename p2##_type, typename p3##_type, typename p4##_type, \ - typename p5##_type, typename p6##_type, typename p7##_type, \ - typename p8##_type, typename p9##_type + p6, p7, p8, p9) \ + , typename p0##_type, typename p1##_type, typename p2##_type, \ + typename p3##_type, typename p4##_type, typename p5##_type, \ + typename p6##_type, typename p7##_type, typename p8##_type, \ + typename p9##_type // Initializes the value parameters. -#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\ - () -#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\ - (p0##_type gmock_p0) : p0(::std::move(gmock_p0)) -#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\ - (p0##_type gmock_p0, p1##_type gmock_p1) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)) -#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\ - (p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)) -#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ +#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS() () +#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0) \ + (p0##_type gmock_p0) : p0(::std::move(gmock_p0)) +#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1) \ + (p0##_type gmock_p0, p1##_type gmock_p1) \ + : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)) +#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2) \ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2) \ + : p0(::std::move(gmock_p0)), \ + p1(::std::move(gmock_p1)), \ + p2(::std::move(gmock_p2)) +#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) \ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3) \ + : p0(::std::move(gmock_p0)), \ + p1(::std::move(gmock_p1)), \ + p2(::std::move(gmock_p2)), \ p3(::std::move(gmock_p3)) -#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)) -#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ +#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) \ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4) \ + : p0(::std::move(gmock_p0)), \ + p1(::std::move(gmock_p1)), \ + p2(::std::move(gmock_p2)), \ + p3(::std::move(gmock_p3)), \ + p4(::std::move(gmock_p4)) +#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) \ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5) \ + : p0(::std::move(gmock_p0)), \ + p1(::std::move(gmock_p1)), \ + p2(::std::move(gmock_p2)), \ + p3(::std::move(gmock_p3)), \ + p4(::std::move(gmock_p4)), \ p5(::std::move(gmock_p5)) -#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)) -#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \ +#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) \ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6) \ + : p0(::std::move(gmock_p0)), \ + p1(::std::move(gmock_p1)), \ + p2(::std::move(gmock_p2)), \ + p3(::std::move(gmock_p3)), \ + p4(::std::move(gmock_p4)), \ + p5(::std::move(gmock_p5)), \ + p6(::std::move(gmock_p6)) +#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7) \ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6, p7##_type gmock_p7) \ + : p0(::std::move(gmock_p0)), \ + p1(::std::move(gmock_p1)), \ + p2(::std::move(gmock_p2)), \ + p3(::std::move(gmock_p3)), \ + p4(::std::move(gmock_p4)), \ + p5(::std::move(gmock_p5)), \ + p6(::std::move(gmock_p6)), \ p7(::std::move(gmock_p7)) -#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \ - p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8)) +#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, \ + p8) \ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8) \ + : p0(::std::move(gmock_p0)), \ + p1(::std::move(gmock_p1)), \ + p2(::std::move(gmock_p2)), \ + p3(::std::move(gmock_p3)), \ + p4(::std::move(gmock_p4)), \ + p5(::std::move(gmock_p5)), \ + p6(::std::move(gmock_p6)), \ + p7(::std::move(gmock_p7)), \ + p8(::std::move(gmock_p8)) #define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ - p9##_type gmock_p9) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \ - p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8)), \ + p7, p8, p9) \ + (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ + p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ + p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ + p9##_type gmock_p9) \ + : p0(::std::move(gmock_p0)), \ + p1(::std::move(gmock_p1)), \ + p2(::std::move(gmock_p2)), \ + p3(::std::move(gmock_p3)), \ + p4(::std::move(gmock_p4)), \ + p5(::std::move(gmock_p5)), \ + p6(::std::move(gmock_p6)), \ + p7(::std::move(gmock_p7)), \ + p8(::std::move(gmock_p8)), \ p9(::std::move(gmock_p9)) // Declares the fields for storing the value parameters. #define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS() #define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0; -#define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \ - p1##_type p1; -#define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \ - p1##_type p1; p2##_type p2; -#define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \ - p1##_type p1; p2##_type p2; p3##_type p3; -#define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ - p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; -#define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ - p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ - p5##_type p5; -#define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ - p5##_type p5; p6##_type p6; -#define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ - p5##_type p5; p6##_type p6; p7##_type p7; -#define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ - p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; +#define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) \ + p0##_type p0; \ + p1##_type p1; +#define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) \ + p0##_type p0; \ + p1##_type p1; \ + p2##_type p2; +#define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) \ + p0##_type p0; \ + p1##_type p1; \ + p2##_type p2; \ + p3##_type p3; +#define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) \ + p0##_type p0; \ + p1##_type p1; \ + p2##_type p2; \ + p3##_type p3; \ + p4##_type p4; +#define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) \ + p0##_type p0; \ + p1##_type p1; \ + p2##_type p2; \ + p3##_type p3; \ + p4##_type p4; \ + p5##_type p5; +#define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) \ + p0##_type p0; \ + p1##_type p1; \ + p2##_type p2; \ + p3##_type p3; \ + p4##_type p4; \ + p5##_type p5; \ + p6##_type p6; +#define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7) \ + p0##_type p0; \ + p1##_type p1; \ + p2##_type p2; \ + p3##_type p3; \ + p4##_type p4; \ + p5##_type p5; \ + p6##_type p6; \ + p7##_type p7; +#define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, \ + p8) \ + p0##_type p0; \ + p1##_type p1; \ + p2##_type p2; \ + p3##_type p3; \ + p4##_type p4; \ + p5##_type p5; \ + p6##_type p6; \ + p7##_type p7; \ + p8##_type p8; #define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ - p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \ - p9##_type p9; + p7, p8, p9) \ + p0##_type p0; \ + p1##_type p1; \ + p2##_type p2; \ + p3##_type p3; \ + p4##_type p4; \ + p5##_type p5; \ + p6##_type p6; \ + p7##_type p7; \ + p8##_type p8; \ + p9##_type p9; // Lists the value parameters. #define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS() @@ -326,72 +402,78 @@ #define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1 #define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2 #define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3 -#define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \ - p2, p3, p4 -#define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \ - p1, p2, p3, p4, p5 -#define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) p0, p1, p2, p3, p4, p5, p6 -#define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7) p0, p1, p2, p3, p4, p5, p6, p7 -#define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8 +#define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) \ + p0, p1, p2, p3, p4 +#define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) \ + p0, p1, p2, p3, p4, p5 +#define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) \ + p0, p1, p2, p3, p4, p5, p6 +#define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7) \ + p0, p1, p2, p3, p4, p5, p6, p7 +#define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, \ + p8) \ + p0, p1, p2, p3, p4, p5, p6, p7, p8 #define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 + p7, p8, p9) \ + p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 // Lists the value parameter types. #define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS() #define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \ - p1##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \ - p1##_type, p2##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ - p0##_type, p1##_type, p2##_type, p3##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ - p0##_type, p1##_type, p2##_type, p3##_type, p4##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ - p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) \ + , p0##_type, p1##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) \ + , p0##_type, p1##_type, p2##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) \ + , p0##_type, p1##_type, p2##_type, p3##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) \ + , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type +#define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) \ + , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type #define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \ - p6##_type + p6) \ + , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, p6##_type #define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type + p6, p7) \ + , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \ + p6##_type, p7##_type #define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type, p8##_type + p6, p7, p8) \ + , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \ + p6##_type, p7##_type, p8##_type #define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type, p8##_type, p9##_type + p6, p7, p8, p9) \ + , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \ + p6##_type, p7##_type, p8##_type, p9##_type // Declares the value parameters. #define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS() #define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0 -#define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \ - p1##_type p1 -#define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \ - p1##_type p1, p2##_type p2 -#define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \ - p1##_type p1, p2##_type p2, p3##_type p3 -#define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ - p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4 -#define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ - p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ - p5##_type p5 -#define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ - p5##_type p5, p6##_type p6 -#define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ - p5##_type p5, p6##_type p6, p7##_type p7 -#define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8 +#define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) \ + p0##_type p0, p1##_type p1 +#define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) \ + p0##_type p0, p1##_type p1, p2##_type p2 +#define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) \ + p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3 +#define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) \ + p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4 +#define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) \ + p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ + p5##_type p5 +#define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) \ + p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ + p5##_type p5, p6##_type p6 +#define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7) \ + p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ + p5##_type p5, p6##_type p6, p7##_type p7 +#define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, \ + p8) \ + p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ + p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8 #define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ - p9##_type p9 + p7, p8, p9) \ + p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ + p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, p9##_type p9 // The suffix of the class template implementing the action template. #define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS() @@ -403,79 +485,81 @@ #define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6 #define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7 #define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7) P8 + p7) \ + P8 #define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8) P9 + p7, p8) \ + P9 #define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9) P10 + p7, p8, p9) \ + P10 // The name of the class template implementing the action template. -#define GMOCK_ACTION_CLASS_(name, value_params)\ - GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params) - -#define ACTION_TEMPLATE(name, template_params, value_params)\ - template \ - class GMOCK_ACTION_CLASS_(name, value_params) {\ - public:\ - explicit GMOCK_ACTION_CLASS_(name, value_params)\ - GMOCK_INTERNAL_INIT_##value_params {}\ - template \ - class gmock_Impl : public ::testing::ActionInterface {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function::Result return_type;\ - typedef typename ::testing::internal::Function::ArgumentTuple\ - args_type;\ - explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper::\ - Perform(this, args);\ - }\ - template \ - return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const;\ - GMOCK_INTERNAL_DEFN_##value_params\ - };\ - template operator ::testing::Action() const {\ - return ::testing::Action(\ - new gmock_Impl(GMOCK_INTERNAL_LIST_##value_params));\ - }\ - GMOCK_INTERNAL_DEFN_##value_params\ - };\ - template \ - inline GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ - GMOCK_INTERNAL_DECL_##value_params) {\ - return GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ - GMOCK_INTERNAL_LIST_##value_params);\ - }\ - template \ - template \ - template \ - typename ::testing::internal::Function::Result\ - GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl::\ - gmock_PerformImpl(\ +#define GMOCK_ACTION_CLASS_(name, value_params) \ + GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params) + +#define ACTION_TEMPLATE(name, template_params, value_params) \ + template \ + class GMOCK_ACTION_CLASS_(name, value_params) { \ + public: \ + explicit GMOCK_ACTION_CLASS_(name, value_params) GMOCK_INTERNAL_INIT_ \ + ##value_params {} \ + template \ + class gmock_Impl : public ::testing::ActionInterface { \ + public: \ + typedef F function_type; \ + typedef typename ::testing::internal::Function::Result return_type; \ + typedef \ + typename ::testing::internal::Function::ArgumentTuple args_type; \ + explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {} \ + return_type Perform(const args_type& args) override { \ + return ::testing::internal::ActionHelper::Perform(this, \ + args); \ + } \ + template \ + return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \ + GMOCK_INTERNAL_DEFN_##value_params \ + }; \ + template \ + operator ::testing::Action() const { \ + return ::testing::Action( \ + new gmock_Impl(GMOCK_INTERNAL_LIST_##value_params)); \ + } \ + GMOCK_INTERNAL_DEFN_##value_params \ + }; \ + template \ + inline GMOCK_ACTION_CLASS_( \ + name, value_params) \ + name(GMOCK_INTERNAL_DECL_##value_params) { \ + return GMOCK_ACTION_CLASS_( \ + name, value_params)( \ + GMOCK_INTERNAL_LIST_##value_params); \ + } \ + template \ + template \ + template \ + typename ::testing::internal::Function::Result GMOCK_ACTION_CLASS_( \ + name, value_params):: \ + gmock_Impl::gmock_PerformImpl( \ GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - namespace testing { - // The ACTION*() macros trigger warning C4100 (unreferenced formal // parameter) in MSVC with -W4. Unfortunately they cannot be fixed in // the macro definition, as the warnings are generated when the macro // is expanded and macro expansion cannot contain #pragma. Therefore // we suppress them here. #ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) +#pragma warning(push) +#pragma warning(disable : 4100) #endif // Various overloads for InvokeArgument(). @@ -508,98 +592,87 @@ namespace testing { // InvokeArgument action from temporary values and have it performed // later. -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(InvokeArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_0_VALUE_PARAMS()) { using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl(internal::invoke_argument::AdlTag(), ::std::get(args)); } -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(InvokeArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_1_VALUE_PARAMS(p0)) { using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl(internal::invoke_argument::AdlTag(), ::std::get(args), p0); } -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(InvokeArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_2_VALUE_PARAMS(p0, p1)) { using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl(internal::invoke_argument::AdlTag(), ::std::get(args), p0, p1); } -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(InvokeArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_3_VALUE_PARAMS(p0, p1, p2)) { using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl(internal::invoke_argument::AdlTag(), ::std::get(args), p0, p1, p2); } -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(InvokeArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl(internal::invoke_argument::AdlTag(), ::std::get(args), p0, p1, p2, p3); } -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(InvokeArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl(internal::invoke_argument::AdlTag(), ::std::get(args), p0, p1, p2, p3, p4); } -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(InvokeArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl(internal::invoke_argument::AdlTag(), ::std::get(args), p0, p1, p2, p3, p4, p5); } -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(InvokeArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl(internal::invoke_argument::AdlTag(), ::std::get(args), p0, p1, p2, p3, p4, p5, p6); } -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(InvokeArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl(internal::invoke_argument::AdlTag(), ::std::get(args), p0, p1, p2, p3, p4, p5, p6, p7); } -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(InvokeArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl(internal::invoke_argument::AdlTag(), ::std::get(args), p0, p1, p2, p3, p4, p5, p6, p7, - p8); + p8); } -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(InvokeArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { using internal::invoke_argument::InvokeArgumentAdl; return InvokeArgumentAdl(internal::invoke_argument::AdlTag(), ::std::get(args), p0, p1, p2, p3, p4, p5, p6, p7, - p8, p9); + p8, p9); } #ifdef _MSC_VER -# pragma warning(pop) +#pragma warning(pop) #endif } // namespace testing diff --git a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-matchers.h b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-matchers.h index dd59cc94d..5ee98e439 100644 --- a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-matchers.h +++ b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-matchers.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // The MATCHER* family of macros can be used in a namespace scope to @@ -396,7 +395,7 @@ class MatcherCastImpl { // is already a Matcher. This only compiles when type T can be // statically converted to type U. template -class MatcherCastImpl > { +class MatcherCastImpl> { public: static Matcher Cast(const Matcher& source_matcher) { return Matcher(new Impl(source_matcher)); @@ -450,7 +449,7 @@ class MatcherCastImpl > { // This even more specialized version is used for efficiently casting // a matcher to its own type. template -class MatcherCastImpl > { +class MatcherCastImpl> { public: static Matcher Cast(const Matcher& matcher) { return matcher; } }; @@ -544,7 +543,7 @@ inline Matcher SafeMatcherCast(const Matcher& matcher) { constexpr bool kUIsOther = GMOCK_KIND_OF_(RawU) == internal::kOther; GTEST_COMPILE_ASSERT_( kTIsOther || kUIsOther || - (internal::LosslessArithmeticConvertible::value), + (internal::LosslessArithmeticConvertible::value), conversion_of_arithmetic_types_must_be_lossless); return MatcherCast(matcher); } @@ -689,8 +688,7 @@ bool TupleMatches(const MatcherTuple& matcher_tuple, // is no failure, nothing will be streamed to os. template void ExplainMatchFailureTupleTo(const MatcherTuple& matchers, - const ValueTuple& values, - ::std::ostream* os) { + const ValueTuple& values, ::std::ostream* os) { TuplePrefix::value>::ExplainMatchFailuresTo( matchers, values, os); } @@ -714,14 +712,14 @@ class TransformTupleValuesHelper { private: template struct IterateOverTuple { - OutIter operator() (Func f, const Tup& t, OutIter out) const { + OutIter operator()(Func f, const Tup& t, OutIter out) const { *out++ = f(::std::get(t)); return IterateOverTuple()(f, t, out); } }; template struct IterateOverTuple { - OutIter operator() (Func /* f */, const Tup& /* t */, OutIter out) const { + OutIter operator()(Func /* f */, const Tup& /* t */, OutIter out) const { return out; } }; @@ -759,7 +757,9 @@ class AnyMatcherImpl : public MatcherInterface { class AnythingMatcher { public: template - operator Matcher() const { return A(); } + operator Matcher() const { + return A(); + } }; // Implements the polymorphic IsNull() matcher, which matches any raw or smart @@ -773,9 +773,7 @@ class IsNullMatcher { } void DescribeTo(::std::ostream* os) const { *os << "is NULL"; } - void DescribeNegationTo(::std::ostream* os) const { - *os << "isn't NULL"; - } + void DescribeNegationTo(::std::ostream* os) const { *os << "isn't NULL"; } }; // Implements the polymorphic NotNull() matcher, which matches any raw or smart @@ -789,9 +787,7 @@ class NotNullMatcher { } void DescribeTo(::std::ostream* os) const { *os << "isn't NULL"; } - void DescribeNegationTo(::std::ostream* os) const { - *os << "is NULL"; - } + void DescribeNegationTo(::std::ostream* os) const { *os << "is NULL"; } }; // Ref(variable) matches any argument that is a reference to @@ -877,8 +873,7 @@ inline bool CaseInsensitiveCStringEquals(const wchar_t* lhs, // String comparison for narrow or wide strings that can have embedded NUL // characters. template -bool CaseInsensitiveStringEquals(const StringType& s1, - const StringType& s2) { +bool CaseInsensitiveStringEquals(const StringType& s1, const StringType& s2) { // Are the heads equal? if (!CaseInsensitiveCStringEquals(s1.c_str(), s2.c_str())) { return false; @@ -939,8 +934,8 @@ class StrEqualityMatcher { bool MatchAndExplain(const MatcheeStringType& s, MatchResultListener* /* listener */) const { const StringType s2(s); - const bool eq = case_sensitive_ ? s2 == string_ : - CaseInsensitiveStringEquals(s2, string_); + const bool eq = case_sensitive_ ? s2 == string_ + : CaseInsensitiveStringEquals(s2, string_); return expect_eq_ == eq; } @@ -1027,8 +1022,7 @@ class HasSubstrMatcher { template class StartsWithMatcher { public: - explicit StartsWithMatcher(const StringType& prefix) : prefix_(prefix) { - } + explicit StartsWithMatcher(const StringType& prefix) : prefix_(prefix) {} #if GTEST_INTERNAL_HAS_STRING_VIEW bool MatchAndExplain(const internal::StringView& s, @@ -1059,7 +1053,7 @@ class StartsWithMatcher { MatchResultListener* /* listener */) const { const StringType& s2(s); return s2.length() >= prefix_.length() && - s2.substr(0, prefix_.length()) == prefix_; + s2.substr(0, prefix_.length()) == prefix_; } void DescribeTo(::std::ostream* os) const { @@ -1113,7 +1107,7 @@ class EndsWithMatcher { MatchResultListener* /* listener */) const { const StringType& s2(s); return s2.length() >= suffix_.length() && - s2.substr(s2.length() - suffix_.length()) == suffix_; + s2.substr(s2.length() - suffix_.length()) == suffix_; } void DescribeTo(::std::ostream* os) const { @@ -1203,8 +1197,7 @@ class Ge2Matcher : public PairMatchBase { template class NotMatcherImpl : public MatcherInterface { public: - explicit NotMatcherImpl(const Matcher& matcher) - : matcher_(matcher) {} + explicit NotMatcherImpl(const Matcher& matcher) : matcher_(matcher) {} bool MatchAndExplain(const T& x, MatchResultListener* listener) const override { @@ -1248,7 +1241,7 @@ class NotMatcher { template class AllOfMatcherImpl : public MatcherInterface { public: - explicit AllOfMatcherImpl(std::vector > matchers) + explicit AllOfMatcherImpl(std::vector> matchers) : matchers_(std::move(matchers)) {} void DescribeTo(::std::ostream* os) const override { @@ -1299,7 +1292,7 @@ class AllOfMatcherImpl : public MatcherInterface { } private: - const std::vector > matchers_; + const std::vector> matchers_; }; // VariadicMatcher is used for the variadic implementation of @@ -1322,14 +1315,14 @@ class VariadicMatcher { // all of the provided matchers (Matcher1, Matcher2, ...) can match. template operator Matcher() const { - std::vector > values; + std::vector> values; CreateVariadicMatcher(&values, std::integral_constant()); return Matcher(new CombiningMatcher(std::move(values))); } private: template - void CreateVariadicMatcher(std::vector >* values, + void CreateVariadicMatcher(std::vector>* values, std::integral_constant) const { values->push_back(SafeMatcherCast(std::get(matchers_))); CreateVariadicMatcher(values, std::integral_constant()); @@ -1337,7 +1330,7 @@ class VariadicMatcher { template void CreateVariadicMatcher( - std::vector >*, + std::vector>*, std::integral_constant) const {} std::tuple matchers_; @@ -1353,7 +1346,7 @@ using AllOfMatcher = VariadicMatcher; template class AnyOfMatcherImpl : public MatcherInterface { public: - explicit AnyOfMatcherImpl(std::vector > matchers) + explicit AnyOfMatcherImpl(std::vector> matchers) : matchers_(std::move(matchers)) {} void DescribeTo(::std::ostream* os) const override { @@ -1404,7 +1397,7 @@ class AnyOfMatcherImpl : public MatcherInterface { } private: - const std::vector > matchers_; + const std::vector> matchers_; }; // AnyOfMatcher is used for the variadic implementation of AnyOf(m_1, m_2, ...). @@ -1460,8 +1453,7 @@ class TrulyMatcher { // We cannot write 'return !!predicate_(x);' as that doesn't work // when predicate_(x) returns a class convertible to bool but // having no operator!(). - if (predicate_(x)) - return true; + if (predicate_(x)) return true; return false; } @@ -1568,8 +1560,8 @@ class PredicateFormatterFromMatcher { // used for implementing ASSERT_THAT() and EXPECT_THAT(). // Implementation detail: 'matcher' is received by-value to force decaying. template -inline PredicateFormatterFromMatcher -MakePredicateFormatterFromMatcher(M matcher) { +inline PredicateFormatterFromMatcher MakePredicateFormatterFromMatcher( + M matcher) { return PredicateFormatterFromMatcher(std::move(matcher)); } @@ -1584,9 +1576,7 @@ class IsNanMatcher { } void DescribeTo(::std::ostream* os) const { *os << "is NaN"; } - void DescribeNegationTo(::std::ostream* os) const { - *os << "isn't NaN"; - } + void DescribeNegationTo(::std::ostream* os) const { *os << "isn't NaN"; } }; // Implements the polymorphic floating point equality matcher, which matches @@ -1602,9 +1592,8 @@ class FloatingEqMatcher { // equality comparisons between NANs will always return false. We specify a // negative max_abs_error_ term to indicate that ULP-based approximation will // be used for comparison. - FloatingEqMatcher(FloatType expected, bool nan_eq_nan) : - expected_(expected), nan_eq_nan_(nan_eq_nan), max_abs_error_(-1) { - } + FloatingEqMatcher(FloatType expected, bool nan_eq_nan) + : expected_(expected), nan_eq_nan_(nan_eq_nan), max_abs_error_(-1) {} // Constructor that supports a user-specified max_abs_error that will be used // for comparison instead of ULP-based approximation. The max absolute @@ -1666,8 +1655,8 @@ class FloatingEqMatcher { // os->precision() returns the previously set precision, which we // store to restore the ostream to its original configuration // after outputting. - const ::std::streamsize old_precision = os->precision( - ::std::numeric_limits::digits10 + 2); + const ::std::streamsize old_precision = + os->precision(::std::numeric_limits::digits10 + 2); if (FloatingPoint(expected_).is_nan()) { if (nan_eq_nan_) { *os << "is NaN"; @@ -1685,8 +1674,8 @@ class FloatingEqMatcher { void DescribeNegationTo(::std::ostream* os) const override { // As before, get original precision. - const ::std::streamsize old_precision = os->precision( - ::std::numeric_limits::digits10 + 2); + const ::std::streamsize old_precision = + os->precision(::std::numeric_limits::digits10 + 2); if (FloatingPoint(expected_).is_nan()) { if (nan_eq_nan_) { *os << "isn't NaN"; @@ -1704,9 +1693,7 @@ class FloatingEqMatcher { } private: - bool HasMaxAbsError() const { - return max_abs_error_ >= 0; - } + bool HasMaxAbsError() const { return max_abs_error_ >= 0; } const FloatType expected_; const bool nan_eq_nan_; @@ -1781,9 +1768,8 @@ class FloatingEq2Matcher { template class Impl : public MatcherInterface { public: - Impl(FloatType max_abs_error, bool nan_eq_nan) : - max_abs_error_(max_abs_error), - nan_eq_nan_(nan_eq_nan) {} + Impl(FloatType max_abs_error, bool nan_eq_nan) + : max_abs_error_(max_abs_error), nan_eq_nan_(nan_eq_nan) {} bool MatchAndExplain(Tuple args, MatchResultListener* listener) const override { @@ -1900,9 +1886,7 @@ class WhenDynamicCastToMatcherBase { protected: const Matcher matcher_; - static std::string GetToName() { - return GetTypeName(); - } + static std::string GetToName() { return GetTypeName(); } private: static void GetCastTypeDescription(::std::ostream* os) { @@ -2039,7 +2023,7 @@ class PropertyMatcher { } template - bool MatchAndExplain(const T&value, MatchResultListener* listener) const { + bool MatchAndExplain(const T& value, MatchResultListener* listener) const { return MatchAndExplainImpl( typename std::is_pointer::type>::type(), value, listener); @@ -2091,16 +2075,16 @@ struct CallableTraits { // Specialization for function pointers. template -struct CallableTraits { +struct CallableTraits { typedef ResType ResultType; - typedef ResType(*StorageType)(ArgType); + typedef ResType (*StorageType)(ArgType); - static void CheckIsValid(ResType(*f)(ArgType)) { + static void CheckIsValid(ResType (*f)(ArgType)) { GTEST_CHECK_(f != nullptr) << "NULL function pointer is passed into ResultOf()."; } template - static ResType Invoke(ResType(*f)(ArgType), T arg) { + static ResType Invoke(ResType (*f)(ArgType), T arg) { return (*f)(arg); } }; @@ -2173,8 +2157,7 @@ template class SizeIsMatcher { public: explicit SizeIsMatcher(const SizeMatcher& size_matcher) - : size_matcher_(size_matcher) { - } + : size_matcher_(size_matcher) {} template operator Matcher() const { @@ -2202,8 +2185,8 @@ class SizeIsMatcher { SizeType size = container.size(); StringMatchResultListener size_listener; const bool result = size_matcher_.MatchAndExplain(size, &size_listener); - *listener - << "whose size " << size << (result ? " matches" : " doesn't match"); + *listener << "whose size " << size + << (result ? " matches" : " doesn't match"); PrintIfNotEmpty(size_listener.str(), listener->stream()); return result; } @@ -2232,8 +2215,9 @@ class BeginEndDistanceIsMatcher { template class Impl : public MatcherInterface { public: - typedef internal::StlContainerView< - GTEST_REMOVE_REFERENCE_AND_CONST_(Container)> ContainerView; + typedef internal::StlContainerView + ContainerView; typedef typename std::iterator_traits< typename ContainerView::type::const_iterator>::difference_type DistanceType; @@ -2315,8 +2299,7 @@ class ContainerEqMatcher { LhsView; typedef typename LhsView::type LhsStlContainer; StlContainerReference lhs_stl_container = LhsView::ConstReference(lhs); - if (lhs_stl_container == expected_) - return true; + if (lhs_stl_container == expected_) return true; ::std::ostream* const os = listener->stream(); if (os != nullptr) { @@ -2341,9 +2324,9 @@ class ContainerEqMatcher { bool printed_header2 = false; for (typename StlContainer::const_iterator it = expected_.begin(); it != expected_.end(); ++it) { - if (internal::ArrayAwareFind( - lhs_stl_container.begin(), lhs_stl_container.end(), *it) == - lhs_stl_container.end()) { + if (internal::ArrayAwareFind(lhs_stl_container.begin(), + lhs_stl_container.end(), + *it) == lhs_stl_container.end()) { if (printed_header2) { *os << ", "; } else { @@ -2366,7 +2349,9 @@ class ContainerEqMatcher { // A comparator functor that uses the < operator to compare two values. struct LessComparator { template - bool operator()(const T& lhs, const U& rhs) const { return lhs < rhs; } + bool operator()(const T& lhs, const U& rhs) const { + return lhs < rhs; + } }; // Implements WhenSortedBy(comparator, container_matcher). @@ -2385,14 +2370,16 @@ class WhenSortedByMatcher { template class Impl : public MatcherInterface { public: - typedef internal::StlContainerView< - GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView; + typedef internal::StlContainerView + LhsView; typedef typename LhsView::type LhsStlContainer; typedef typename LhsView::const_reference LhsStlContainerReference; // Transforms std::pair into std::pair // so that we can match associative containers. - typedef typename RemoveConstFromKey< - typename LhsStlContainer::value_type>::type LhsValue; + typedef + typename RemoveConstFromKey::type + LhsValue; Impl(const Comparator& comparator, const ContainerMatcher& matcher) : comparator_(comparator), matcher_(matcher) {} @@ -2412,8 +2399,8 @@ class WhenSortedByMatcher { LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs); ::std::vector sorted_container(lhs_stl_container.begin(), lhs_stl_container.end()); - ::std::sort( - sorted_container.begin(), sorted_container.end(), comparator_); + ::std::sort(sorted_container.begin(), sorted_container.end(), + comparator_); if (!listener->IsInterested()) { // If the listener is not interested, we do not need to @@ -2426,8 +2413,8 @@ class WhenSortedByMatcher { *listener << " when sorted"; StringMatchResultListener inner_listener; - const bool match = matcher_.MatchAndExplain(sorted_container, - &inner_listener); + const bool match = + matcher_.MatchAndExplain(sorted_container, &inner_listener); PrintIfNotEmpty(inner_listener.str(), listener->stream()); return match; } @@ -2482,8 +2469,9 @@ class PointwiseMatcher { template class Impl : public MatcherInterface { public: - typedef internal::StlContainerView< - GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView; + typedef internal::StlContainerView + LhsView; typedef typename LhsView::type LhsStlContainer; typedef typename LhsView::const_reference LhsStlContainerReference; typedef typename LhsStlContainer::value_type LhsValue; @@ -2577,13 +2565,12 @@ class QuantifierMatcherImpl : public MatcherInterface { template explicit QuantifierMatcherImpl(InnerMatcher inner_matcher) : inner_matcher_( - testing::SafeMatcherCast(inner_matcher)) {} + testing::SafeMatcherCast(inner_matcher)) {} // Checks whether: // * All elements in the container match, if all_elements_should_match. // * Any element in the container matches, if !all_elements_should_match. - bool MatchAndExplainImpl(bool all_elements_should_match, - Container container, + bool MatchAndExplainImpl(bool all_elements_should_match, Container container, MatchResultListener* listener) const { StlContainerReference stl_container = View::ConstReference(container); size_t i = 0; @@ -2727,8 +2714,7 @@ class KeyMatcherImpl : public MatcherInterface { template explicit KeyMatcherImpl(InnerMatcher inner_matcher) : inner_matcher_( - testing::SafeMatcherCast(inner_matcher)) { - } + testing::SafeMatcherCast(inner_matcher)) {} // Returns true if and only if 'key_value.first' (the key) matches the inner // matcher. @@ -2790,8 +2776,7 @@ class PairMatcherImpl : public MatcherInterface { : first_matcher_( testing::SafeMatcherCast(first_matcher)), second_matcher_( - testing::SafeMatcherCast(second_matcher)) { - } + testing::SafeMatcherCast(second_matcher)) {} // Describes what this matcher does. void DescribeTo(::std::ostream* os) const override { @@ -2869,7 +2854,7 @@ class PairMatcher { : first_matcher_(first_matcher), second_matcher_(second_matcher) {} template - operator Matcher () const { + operator Matcher() const { return Matcher( new PairMatcherImpl(first_matcher_, second_matcher_)); } @@ -3021,7 +3006,7 @@ class ElementsAreMatcherImpl : public MatcherInterface { size_t count() const { return matchers_.size(); } - ::std::vector > matchers_; + ::std::vector> matchers_; }; // Connectivity matrix of (elements X matchers), in element-major order. @@ -3033,8 +3018,7 @@ class GTEST_API_ MatchMatrix { MatchMatrix(size_t num_elements, size_t num_matchers) : num_elements_(num_elements), num_matchers_(num_matchers), - matched_(num_elements_* num_matchers_, 0) { - } + matched_(num_elements_ * num_matchers_, 0) {} size_t LhsSize() const { return num_elements_; } size_t RhsSize() const { return num_matchers_; } @@ -3073,8 +3057,7 @@ typedef ::std::vector ElementMatcherPairs; // Returns a maximum bipartite matching for the specified graph 'g'. // The matching is represented as a vector of {element, matcher} pairs. -GTEST_API_ ElementMatcherPairs -FindMaxBipartiteMatching(const MatchMatrix& g); +GTEST_API_ ElementMatcherPairs FindMaxBipartiteMatching(const MatchMatrix& g); struct UnorderedMatcherRequire { enum Flags { @@ -3111,9 +3094,7 @@ class GTEST_API_ UnorderedElementsAreMatcherImplBase { bool FindPairing(const MatchMatrix& matrix, MatchResultListener* listener) const; - MatcherDescriberVec& matcher_describers() { - return matcher_describers_; - } + MatcherDescriberVec& matcher_describers() { return matcher_describers_; } static Message Elements(size_t n) { return Message() << n << " element" << (n == 1 ? "" : "s"); @@ -3218,7 +3199,7 @@ class UnorderedElementsAreMatcherImpl return matrix; } - ::std::vector > matchers_; + ::std::vector> matchers_; }; // Functor for use in TransformTuple. @@ -3243,7 +3224,7 @@ class UnorderedElementsAreMatcher { typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; typedef typename internal::StlContainerView::type View; typedef typename View::value_type Element; - typedef ::std::vector > MatcherVec; + typedef ::std::vector> MatcherVec; MatcherVec matchers; matchers.reserve(::std::tuple_size::value); TransformTupleValues(CastAndAppendTransform(), matchers_, @@ -3274,7 +3255,7 @@ class ElementsAreMatcher { typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; typedef typename internal::StlContainerView::type View; typedef typename View::value_type Element; - typedef ::std::vector > MatcherVec; + typedef ::std::vector> MatcherVec; MatcherVec matchers; matchers.reserve(::std::tuple_size::value); TransformTupleValues(CastAndAppendTransform(), matchers_, @@ -3688,8 +3669,8 @@ ElementsAreArray(Iter first, Iter last) { } template -inline internal::ElementsAreArrayMatcher ElementsAreArray( - const T* pointer, size_t count) { +inline internal::ElementsAreArrayMatcher ElementsAreArray(const T* pointer, + size_t count) { return ElementsAreArray(pointer, pointer + count); } @@ -3706,8 +3687,8 @@ ElementsAreArray(const Container& container) { } template -inline internal::ElementsAreArrayMatcher -ElementsAreArray(::std::initializer_list xs) { +inline internal::ElementsAreArrayMatcher ElementsAreArray( + ::std::initializer_list xs) { return ElementsAreArray(xs.begin(), xs.end()); } @@ -3734,14 +3715,14 @@ UnorderedElementsAreArray(Iter first, Iter last) { } template -inline internal::UnorderedElementsAreArrayMatcher -UnorderedElementsAreArray(const T* pointer, size_t count) { +inline internal::UnorderedElementsAreArrayMatcher UnorderedElementsAreArray( + const T* pointer, size_t count) { return UnorderedElementsAreArray(pointer, pointer + count); } template -inline internal::UnorderedElementsAreArrayMatcher -UnorderedElementsAreArray(const T (&array)[N]) { +inline internal::UnorderedElementsAreArrayMatcher UnorderedElementsAreArray( + const T (&array)[N]) { return UnorderedElementsAreArray(array, N); } @@ -3753,8 +3734,8 @@ UnorderedElementsAreArray(const Container& container) { } template -inline internal::UnorderedElementsAreArrayMatcher -UnorderedElementsAreArray(::std::initializer_list xs) { +inline internal::UnorderedElementsAreArrayMatcher UnorderedElementsAreArray( + ::std::initializer_list xs) { return UnorderedElementsAreArray(xs.begin(), xs.end()); } @@ -3776,7 +3757,9 @@ inline Matcher A() { // Creates a matcher that matches any value of the given type T. template -inline Matcher An() { return A(); } +inline Matcher An() { + return A(); +} template Matcher internal::MatcherCastImpl::CastImpl( @@ -3786,14 +3769,14 @@ Matcher internal::MatcherCastImpl::CastImpl( } // Creates a polymorphic matcher that matches any NULL pointer. -inline PolymorphicMatcher IsNull() { +inline PolymorphicMatcher IsNull() { return MakePolymorphicMatcher(internal::IsNullMatcher()); } // Creates a polymorphic matcher that matches any non-NULL pointer. // This is convenient as Not(NULL) doesn't compile (the compiler // thinks that that expression is comparing a pointer with an integer). -inline PolymorphicMatcher NotNull() { +inline PolymorphicMatcher NotNull() { return MakePolymorphicMatcher(internal::NotNullMatcher()); } @@ -3824,8 +3807,8 @@ inline internal::FloatingEqMatcher NanSensitiveDoubleEq(double rhs) { // Creates a matcher that matches any double argument approximately equal to // rhs, up to the specified max absolute error bound, where two NANs are // considered unequal. The max absolute error bound must be non-negative. -inline internal::FloatingEqMatcher DoubleNear( - double rhs, double max_abs_error) { +inline internal::FloatingEqMatcher DoubleNear(double rhs, + double max_abs_error) { return internal::FloatingEqMatcher(rhs, false, max_abs_error); } @@ -3852,8 +3835,8 @@ inline internal::FloatingEqMatcher NanSensitiveFloatEq(float rhs) { // Creates a matcher that matches any float argument approximately equal to // rhs, up to the specified max absolute error bound, where two NANs are // considered unequal. The max absolute error bound must be non-negative. -inline internal::FloatingEqMatcher FloatNear( - float rhs, float max_abs_error) { +inline internal::FloatingEqMatcher FloatNear(float rhs, + float max_abs_error) { return internal::FloatingEqMatcher(rhs, false, max_abs_error); } @@ -3881,7 +3864,7 @@ inline internal::PointeeMatcher Pointee( // If To is a reference and the cast fails, this matcher returns false // immediately. template -inline PolymorphicMatcher > +inline PolymorphicMatcher> WhenDynamicCastTo(const Matcher& inner_matcher) { return MakePolymorphicMatcher( internal::WhenDynamicCastToMatcher(inner_matcher)); @@ -3893,12 +3876,10 @@ WhenDynamicCastTo(const Matcher& inner_matcher) { // Field(&Foo::number, Ge(5)) // matches a Foo object x if and only if x.number >= 5. template -inline PolymorphicMatcher< - internal::FieldMatcher > Field( +inline PolymorphicMatcher> Field( FieldType Class::*field, const FieldMatcher& matcher) { - return MakePolymorphicMatcher( - internal::FieldMatcher( - field, MatcherCast(matcher))); + return MakePolymorphicMatcher(internal::FieldMatcher( + field, MatcherCast(matcher))); // The call to MatcherCast() is required for supporting inner // matchers of compatible types. For example, it allows // Field(&Foo::bar, m) @@ -3908,7 +3889,7 @@ inline PolymorphicMatcher< // Same as Field() but also takes the name of the field to provide better error // messages. template -inline PolymorphicMatcher > Field( +inline PolymorphicMatcher> Field( const std::string& field_name, FieldType Class::*field, const FieldMatcher& matcher) { return MakePolymorphicMatcher(internal::FieldMatcher( @@ -3921,7 +3902,7 @@ inline PolymorphicMatcher > Field( // matches a Foo object x if and only if x.str() starts with "hi". template inline PolymorphicMatcher > + Class, PropertyType, PropertyType (Class::*)() const>> Property(PropertyType (Class::*property)() const, const PropertyMatcher& matcher) { return MakePolymorphicMatcher( @@ -3938,7 +3919,7 @@ Property(PropertyType (Class::*property)() const, // better error messages. template inline PolymorphicMatcher > + Class, PropertyType, PropertyType (Class::*)() const>> Property(const std::string& property_name, PropertyType (Class::*property)() const, const PropertyMatcher& matcher) { @@ -3951,8 +3932,8 @@ Property(const std::string& property_name, // The same as above but for reference-qualified member functions. template inline PolymorphicMatcher > -Property(PropertyType (Class::*property)() const &, + Class, PropertyType, PropertyType (Class::*)() const&>> +Property(PropertyType (Class::*property)() const&, const PropertyMatcher& matcher) { return MakePolymorphicMatcher( internal::PropertyMatcher inline PolymorphicMatcher > + Class, PropertyType, PropertyType (Class::*)() const&>> Property(const std::string& property_name, - PropertyType (Class::*property)() const &, + PropertyType (Class::*property)() const&, const PropertyMatcher& matcher) { return MakePolymorphicMatcher( internal::PropertyMatcher internal::ResultOfMatcher ResultOf( Callable callable, InnerMatcher matcher) { - return internal::ResultOfMatcher( - std::move(callable), std::move(matcher)); + return internal::ResultOfMatcher(std::move(callable), + std::move(matcher)); } // String matchers. // Matches a string equal to str. template -PolymorphicMatcher > StrEq( +PolymorphicMatcher> StrEq( const internal::StringLike& str) { return MakePolymorphicMatcher( internal::StrEqualityMatcher(std::string(str), true, true)); @@ -4000,7 +3981,7 @@ PolymorphicMatcher > StrEq( // Matches a string not equal to str. template -PolymorphicMatcher > StrNe( +PolymorphicMatcher> StrNe( const internal::StringLike& str) { return MakePolymorphicMatcher( internal::StrEqualityMatcher(std::string(str), false, true)); @@ -4008,7 +3989,7 @@ PolymorphicMatcher > StrNe( // Matches a string equal to str, ignoring case. template -PolymorphicMatcher > StrCaseEq( +PolymorphicMatcher> StrCaseEq( const internal::StringLike& str) { return MakePolymorphicMatcher( internal::StrEqualityMatcher(std::string(str), true, false)); @@ -4016,7 +3997,7 @@ PolymorphicMatcher > StrCaseEq( // Matches a string not equal to str, ignoring case. template -PolymorphicMatcher > StrCaseNe( +PolymorphicMatcher> StrCaseNe( const internal::StringLike& str) { return MakePolymorphicMatcher(internal::StrEqualityMatcher( std::string(str), false, false)); @@ -4025,7 +4006,7 @@ PolymorphicMatcher > StrCaseNe( // Creates a matcher that matches any string, std::string, or C string // that contains the given substring. template -PolymorphicMatcher > HasSubstr( +PolymorphicMatcher> HasSubstr( const internal::StringLike& substring) { return MakePolymorphicMatcher( internal::HasSubstrMatcher(std::string(substring))); @@ -4033,7 +4014,7 @@ PolymorphicMatcher > HasSubstr( // Matches a string that starts with 'prefix' (case-sensitive). template -PolymorphicMatcher > StartsWith( +PolymorphicMatcher> StartsWith( const internal::StringLike& prefix) { return MakePolymorphicMatcher( internal::StartsWithMatcher(std::string(prefix))); @@ -4041,7 +4022,7 @@ PolymorphicMatcher > StartsWith( // Matches a string that ends with 'suffix' (case-sensitive). template -PolymorphicMatcher > EndsWith( +PolymorphicMatcher> EndsWith( const internal::StringLike& suffix) { return MakePolymorphicMatcher( internal::EndsWithMatcher(std::string(suffix))); @@ -4051,50 +4032,50 @@ PolymorphicMatcher > EndsWith( // Wide string matchers. // Matches a string equal to str. -inline PolymorphicMatcher > StrEq( +inline PolymorphicMatcher> StrEq( const std::wstring& str) { return MakePolymorphicMatcher( internal::StrEqualityMatcher(str, true, true)); } // Matches a string not equal to str. -inline PolymorphicMatcher > StrNe( +inline PolymorphicMatcher> StrNe( const std::wstring& str) { return MakePolymorphicMatcher( internal::StrEqualityMatcher(str, false, true)); } // Matches a string equal to str, ignoring case. -inline PolymorphicMatcher > -StrCaseEq(const std::wstring& str) { +inline PolymorphicMatcher> StrCaseEq( + const std::wstring& str) { return MakePolymorphicMatcher( internal::StrEqualityMatcher(str, true, false)); } // Matches a string not equal to str, ignoring case. -inline PolymorphicMatcher > -StrCaseNe(const std::wstring& str) { +inline PolymorphicMatcher> StrCaseNe( + const std::wstring& str) { return MakePolymorphicMatcher( internal::StrEqualityMatcher(str, false, false)); } // Creates a matcher that matches any ::wstring, std::wstring, or C wide string // that contains the given substring. -inline PolymorphicMatcher > HasSubstr( +inline PolymorphicMatcher> HasSubstr( const std::wstring& substring) { return MakePolymorphicMatcher( internal::HasSubstrMatcher(substring)); } // Matches a string that starts with 'prefix' (case-sensitive). -inline PolymorphicMatcher > -StartsWith(const std::wstring& prefix) { +inline PolymorphicMatcher> StartsWith( + const std::wstring& prefix) { return MakePolymorphicMatcher( internal::StartsWithMatcher(prefix)); } // Matches a string that ends with 'suffix' (case-sensitive). -inline PolymorphicMatcher > EndsWith( +inline PolymorphicMatcher> EndsWith( const std::wstring& suffix) { return MakePolymorphicMatcher( internal::EndsWithMatcher(suffix)); @@ -4189,8 +4170,8 @@ inline internal::NotMatcher Not(InnerMatcher m) { // predicate. The predicate can be any unary function or functor // whose return type can be implicitly converted to bool. template -inline PolymorphicMatcher > -Truly(Predicate pred) { +inline PolymorphicMatcher> Truly( + Predicate pred) { return MakePolymorphicMatcher(internal::TrulyMatcher(pred)); } @@ -4201,8 +4182,8 @@ Truly(Predicate pred) { // EXPECT_THAT(container, SizeIs(2)); // Checks container has 2 elements. // EXPECT_THAT(container, SizeIs(Le(2)); // Checks container has at most 2. template -inline internal::SizeIsMatcher -SizeIs(const SizeMatcher& size_matcher) { +inline internal::SizeIsMatcher SizeIs( + const SizeMatcher& size_matcher) { return internal::SizeIsMatcher(size_matcher); } @@ -4212,8 +4193,8 @@ SizeIs(const SizeMatcher& size_matcher) { // do not implement size(). The container must provide const_iterator (with // valid iterator_traits), begin() and end(). template -inline internal::BeginEndDistanceIsMatcher -BeginEndDistanceIs(const DistanceMatcher& distance_matcher) { +inline internal::BeginEndDistanceIsMatcher BeginEndDistanceIs( + const DistanceMatcher& distance_matcher) { return internal::BeginEndDistanceIsMatcher(distance_matcher); } @@ -4222,8 +4203,8 @@ BeginEndDistanceIs(const DistanceMatcher& distance_matcher) { // values that are included in one container but not the other. (Duplicate // values and order differences are not explained.) template -inline PolymorphicMatcher::type>> +inline PolymorphicMatcher< + internal::ContainerEqMatcher::type>> ContainerEq(const Container& rhs) { return MakePolymorphicMatcher(internal::ContainerEqMatcher(rhs)); } @@ -4231,9 +4212,8 @@ ContainerEq(const Container& rhs) { // Returns a matcher that matches a container that, when sorted using // the given comparator, matches container_matcher. template -inline internal::WhenSortedByMatcher -WhenSortedBy(const Comparator& comparator, - const ContainerMatcher& container_matcher) { +inline internal::WhenSortedByMatcher WhenSortedBy( + const Comparator& comparator, const ContainerMatcher& container_matcher) { return internal::WhenSortedByMatcher( comparator, container_matcher); } @@ -4243,9 +4223,9 @@ WhenSortedBy(const Comparator& comparator, template inline internal::WhenSortedByMatcher WhenSorted(const ContainerMatcher& container_matcher) { - return - internal::WhenSortedByMatcher( - internal::LessComparator(), container_matcher); + return internal::WhenSortedByMatcher( + internal::LessComparator(), container_matcher); } // Matches an STL-style container or a native array that contains the @@ -4262,15 +4242,13 @@ Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) { rhs); } - // Supports the Pointwise(m, {a, b, c}) syntax. template -inline internal::PointwiseMatcher > Pointwise( +inline internal::PointwiseMatcher> Pointwise( const TupleMatcher& tuple_matcher, std::initializer_list rhs) { return Pointwise(tuple_matcher, std::vector(rhs)); } - // UnorderedPointwise(pair_matcher, rhs) matches an STL-style // container or a native array that contains the same number of // elements as in rhs, where in some permutation of the container, its @@ -4299,28 +4277,25 @@ UnorderedPointwise(const Tuple2Matcher& tuple2_matcher, RhsView::ConstReference(rhs_container); // Create a matcher for each element in rhs_container. - ::std::vector > matchers; + ::std::vector> matchers; for (typename RhsStlContainer::const_iterator it = rhs_stl_container.begin(); it != rhs_stl_container.end(); ++it) { - matchers.push_back( - internal::MatcherBindSecond(tuple2_matcher, *it)); + matchers.push_back(internal::MatcherBindSecond(tuple2_matcher, *it)); } // Delegate the work to UnorderedElementsAreArray(). return UnorderedElementsAreArray(matchers); } - // Supports the UnorderedPointwise(m, {a, b, c}) syntax. template inline internal::UnorderedElementsAreArrayMatcher< - typename internal::BoundSecondMatcher > + typename internal::BoundSecondMatcher> UnorderedPointwise(const Tuple2Matcher& tuple2_matcher, std::initializer_list rhs) { return UnorderedPointwise(tuple2_matcher, std::vector(rhs)); } - // Matches an STL-style container or a native array that contains at // least one element matching the given value or matcher. // @@ -4508,10 +4483,10 @@ inline internal::KeyMatcher Key(M inner_matcher) { // to match a std::map that contains exactly one element whose key // is >= 5 and whose value equals "foo". template -inline internal::PairMatcher -Pair(FirstMatcher first_matcher, SecondMatcher second_matcher) { - return internal::PairMatcher( - first_matcher, second_matcher); +inline internal::PairMatcher Pair( + FirstMatcher first_matcher, SecondMatcher second_matcher) { + return internal::PairMatcher(first_matcher, + second_matcher); } // Returns a predicate that is satisfied by anything that matches the @@ -4530,8 +4505,8 @@ inline bool Value(const T& value, M matcher) { // Matches the value against the given matcher and explains the match // result to listener. template -inline bool ExplainMatchResult( - M matcher, const T& value, MatchResultListener* listener) { +inline bool ExplainMatchResult(M matcher, const T& value, + MatchResultListener* listener) { return SafeMatcherCast(matcher).MatchAndExplain(value, listener); } @@ -4690,7 +4665,9 @@ internal::ArgsMatcher::type, k...> Args( // // EXPECT_CALL(foo, Bar(_, _)).With(Eq()); template -inline InnerMatcher AllArgs(const InnerMatcher& matcher) { return matcher; } +inline InnerMatcher AllArgs(const InnerMatcher& matcher) { + return matcher; +} // Returns a matcher that matches the value of an optional<> type variable. // The matcher implementation only uses '!arg' and requires that the optional<> @@ -4708,7 +4685,7 @@ inline internal::OptionalMatcher Optional( // Returns a matcher that matches the value of a absl::any type variable. template -PolymorphicMatcher > AnyWith( +PolymorphicMatcher> AnyWith( const Matcher& matcher) { return MakePolymorphicMatcher( internal::any_cast_matcher::AnyCastMatcher(matcher)); @@ -4719,7 +4696,7 @@ PolymorphicMatcher > AnyWith( // functions. // It is compatible with std::variant. template -PolymorphicMatcher > VariantWith( +PolymorphicMatcher> VariantWith( const Matcher& matcher) { return MakePolymorphicMatcher( internal::variant_matcher::VariantMatcher(matcher)); @@ -4729,10 +4706,12 @@ PolymorphicMatcher > VariantWith( // tests. ASSERT_THAT(value, matcher) and EXPECT_THAT(value, matcher) // succeed if and only if the value matches the matcher. If the assertion // fails, the value and the description of the matcher will be printed. -#define ASSERT_THAT(value, matcher) ASSERT_PRED_FORMAT1(\ - ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) -#define EXPECT_THAT(value, matcher) EXPECT_PRED_FORMAT1(\ - ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) +#define ASSERT_THAT(value, matcher) \ + ASSERT_PRED_FORMAT1( \ + ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) +#define EXPECT_THAT(value, matcher) \ + EXPECT_PRED_FORMAT1( \ + ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) // MATCHER* macroses itself are listed below. #define MATCHER(name, description) \ diff --git a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-more-actions.h b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-more-actions.h index 55c2b5743..ca7fac966 100644 --- a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-more-actions.h +++ b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-more-actions.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // This file implements some actions that depend on gmock-generated-actions.h. @@ -49,9 +48,8 @@ namespace internal { // necessary because Visual Studio deprecates ::std::copy, issuing warning 4996. // However Visual Studio 2010 and later do not honor #pragmas which disable that // warning. -template -inline OutputIterator CopyElements(InputIterator first, - InputIterator last, +template +inline OutputIterator CopyElements(InputIterator first, InputIterator last, OutputIterator output) { for (; first != last; ++first, ++output) { *output = *first; @@ -69,37 +67,33 @@ inline OutputIterator CopyElements(InputIterator first, // is expanded and macro expansion cannot contain #pragma. Therefore // we suppress them here. #ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) +#pragma warning(push) +#pragma warning(disable : 4100) #endif // Action ReturnArg() returns the k-th argument of the mock function. -ACTION_TEMPLATE(ReturnArg, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(ReturnArg, HAS_1_TEMPLATE_PARAMS(int, k), AND_0_VALUE_PARAMS()) { return ::std::get(args); } // Action SaveArg(pointer) saves the k-th (0-based) argument of the // mock function to *pointer. -ACTION_TEMPLATE(SaveArg, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(SaveArg, HAS_1_TEMPLATE_PARAMS(int, k), AND_1_VALUE_PARAMS(pointer)) { *pointer = ::std::get(args); } // Action SaveArgPointee(pointer) saves the value pointed to // by the k-th (0-based) argument of the mock function to *pointer. -ACTION_TEMPLATE(SaveArgPointee, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(SaveArgPointee, HAS_1_TEMPLATE_PARAMS(int, k), AND_1_VALUE_PARAMS(pointer)) { *pointer = *::std::get(args); } // Action SetArgReferee(value) assigns 'value' to the variable // referenced by the k-th (0-based) argument of the mock function. -ACTION_TEMPLATE(SetArgReferee, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(SetArgReferee, HAS_1_TEMPLATE_PARAMS(int, k), AND_1_VALUE_PARAMS(value)) { typedef typename ::std::tuple_element::type argk_type; // Ensures that argument #k is a reference. If you get a compiler @@ -115,8 +109,7 @@ ACTION_TEMPLATE(SetArgReferee, // (0-based) argument, which can be either a pointer or an // iterator. The action does not take ownership of the elements in the // source range. -ACTION_TEMPLATE(SetArrayArgument, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(SetArrayArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_2_VALUE_PARAMS(first, last)) { // Visual Studio deprecates ::std::copy, so we use our own copy in that case. #ifdef _MSC_VER @@ -128,8 +121,7 @@ ACTION_TEMPLATE(SetArrayArgument, // Action DeleteArg() deletes the k-th (0-based) argument of the mock // function. -ACTION_TEMPLATE(DeleteArg, - HAS_1_TEMPLATE_PARAMS(int, k), +ACTION_TEMPLATE(DeleteArg, HAS_1_TEMPLATE_PARAMS(int, k), AND_0_VALUE_PARAMS()) { delete ::std::get(args); } @@ -142,19 +134,19 @@ ACTION_P(ReturnPointee, pointer) { return *pointer; } #if GTEST_HAS_EXCEPTIONS // Suppresses the 'unreachable code' warning that VC generates in opt modes. -# ifdef _MSC_VER -# pragma warning(push) // Saves the current warning state. -# pragma warning(disable:4702) // Temporarily disables warning 4702. -# endif +#ifdef _MSC_VER +#pragma warning(push) // Saves the current warning state. +#pragma warning(disable : 4702) // Temporarily disables warning 4702. +#endif ACTION_P(Throw, exception) { throw exception; } -# ifdef _MSC_VER -# pragma warning(pop) // Restores the warning state. -# endif +#ifdef _MSC_VER +#pragma warning(pop) // Restores the warning state. +#endif #endif // GTEST_HAS_EXCEPTIONS #ifdef _MSC_VER -# pragma warning(pop) +#pragma warning(pop) #endif } // namespace testing diff --git a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-more-matchers.h b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-more-matchers.h index b306dd603..1d7053a34 100644 --- a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-more-matchers.h +++ b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-more-matchers.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // This file implements some matchers that depend on gmock-matchers.h. @@ -47,13 +46,13 @@ namespace testing { // Silence C4100 (unreferenced formal // parameter) for MSVC #ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) +#pragma warning(push) +#pragma warning(disable : 4100) #if (_MSC_VER == 1900) // and silence C4800 (C4800: 'int *const ': forcing value // to bool 'true' or 'false') for MSVC 14 -# pragma warning(disable:4800) - #endif +#pragma warning(disable : 4800) +#endif #endif // Defines a matcher that matches an empty container. The container must @@ -83,10 +82,9 @@ MATCHER(IsFalse, negation ? "is true" : "is false") { } #ifdef _MSC_VER -# pragma warning(pop) +#pragma warning(pop) #endif - } // namespace testing #endif // GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_ diff --git a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-nice-strict.h b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-nice-strict.h index 5495a9805..efecf43b7 100644 --- a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-nice-strict.h +++ b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-nice-strict.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Implements class templates NiceMock, NaggyMock, and StrictMock. // // Given a mock class MockFoo that is created using Google Mock, diff --git a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-spec-builders.h b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-spec-builders.h index c6a74ae79..3c2196149 100644 --- a/Testing/lib/googletest-master/googlemock/include/gmock/gmock-spec-builders.h +++ b/Testing/lib/googletest-master/googlemock/include/gmock/gmock-spec-builders.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // This file implements the ON_CALL() and EXPECT_CALL() macros. @@ -70,6 +69,7 @@ #include #include #include + #include "gmock/gmock-actions.h" #include "gmock/gmock-cardinalities.h" #include "gmock/gmock-matchers.h" @@ -78,7 +78,7 @@ #include "gtest/gtest.h" #if GTEST_HAS_EXCEPTIONS -# include // NOLINT +#include // NOLINT #endif GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ @@ -97,13 +97,15 @@ class ExpectationSet; namespace internal { // Implements a mock function. -template class FunctionMocker; +template +class FunctionMocker; // Base class for expectations. class ExpectationBase; // Implements an expectation. -template class TypedExpectation; +template +class TypedExpectation; // Helper class for testing the Expectation class template. class ExpectationTester; @@ -163,10 +165,9 @@ class GTEST_API_ UntypedFunctionMockerBase { // Writes a message that the call is uninteresting (i.e. neither // explicitly expected nor explicitly unexpected) to the given // ostream. - virtual void UntypedDescribeUninterestingCall( - const void* untyped_args, - ::std::ostream* os) const - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0; + virtual void UntypedDescribeUninterestingCall(const void* untyped_args, + ::std::ostream* os) const + GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0; // Returns the expectation that matches the given function arguments // (or NULL is there's no match); when a match is found, @@ -175,10 +176,9 @@ class GTEST_API_ UntypedFunctionMockerBase { // is_excessive is modified to indicate whether the call exceeds the // expected number. virtual const ExpectationBase* UntypedFindMatchingExpectation( - const void* untyped_args, - const void** untyped_action, bool* is_excessive, + const void* untyped_args, const void** untyped_action, bool* is_excessive, ::std::ostream* what, ::std::ostream* why) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0; + GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0; // Prints the given function arguments to the ostream. virtual void UntypedPrintArgs(const void* untyped_args, @@ -188,8 +188,7 @@ class GTEST_API_ UntypedFunctionMockerBase { // this information in the global mock registry. Will be called // whenever an EXPECT_CALL() or ON_CALL() is executed on this mock // method. - void RegisterOwner(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex); + void RegisterOwner(const void* mock_obj) GTEST_LOCK_EXCLUDED_(g_gmock_mutex); // Sets the mock object this mock method belongs to, and sets the // name of the mock function. Will be called upon each invocation @@ -200,13 +199,11 @@ class GTEST_API_ UntypedFunctionMockerBase { // Returns the mock object this mock method belongs to. Must be // called after RegisterOwner() or SetOwnerAndName() has been // called. - const void* MockObject() const - GTEST_LOCK_EXCLUDED_(g_gmock_mutex); + const void* MockObject() const GTEST_LOCK_EXCLUDED_(g_gmock_mutex); // Returns the name of this mock method. Must be called after // SetOwnerAndName() has been called. - const char* Name() const - GTEST_LOCK_EXCLUDED_(g_gmock_mutex); + const char* Name() const GTEST_LOCK_EXCLUDED_(g_gmock_mutex); // Returns the result of invoking this mock function with the given // arguments. This function can be safely called from multiple @@ -445,8 +442,7 @@ class GTEST_API_ Mock { // Returns the reaction Google Mock will have on uninteresting calls // made on the given mock object. static internal::CallReaction GetReactionOnUninterestingCalls( - const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); + const void* mock_obj) GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); // Verifies that all expectations on the given mock object have been // satisfied. Reports one or more Google Test non-fatal failures @@ -459,17 +455,16 @@ class GTEST_API_ Mock { GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex); // Registers a mock object and a mock method it owns. - static void Register( - const void* mock_obj, - internal::UntypedFunctionMockerBase* mocker) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); + static void Register(const void* mock_obj, + internal::UntypedFunctionMockerBase* mocker) + GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); // Tells Google Mock where in the source code mock_obj is used in an // ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this // information helps the user identify which object it is. - static void RegisterUseByOnCallOrExpectCall( - const void* mock_obj, const char* file, int line) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); + static void RegisterUseByOnCallOrExpectCall(const void* mock_obj, + const char* file, int line) + GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); // Unregisters a mock method; removes the owning mock object from // the registry when the last mock method associated with it has @@ -626,7 +621,6 @@ class ExpectationSet { Expectation::Set expectations_; }; - // Sequence objects are used by a user to specify the relative order // in which the expectations should match. They are copyable (we rely // on the compiler-defined copy constructor and assignment operator). @@ -672,6 +666,7 @@ class GTEST_API_ InSequence { public: InSequence(); ~InSequence(); + private: bool sequence_created_; @@ -778,40 +773,34 @@ class GTEST_API_ ExpectationBase { // the current thread. // Retires all pre-requisites of this expectation. - void RetireAllPreRequisites() - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); + void RetireAllPreRequisites() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); // Returns true if and only if this expectation is retired. - bool is_retired() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { + bool is_retired() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); return retired_; } // Retires this expectation. - void Retire() - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { + void Retire() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); retired_ = true; } // Returns true if and only if this expectation is satisfied. - bool IsSatisfied() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { + bool IsSatisfied() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); return cardinality().IsSatisfiedByCallCount(call_count_); } // Returns true if and only if this expectation is saturated. - bool IsSaturated() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { + bool IsSaturated() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); return cardinality().IsSaturatedByCallCount(call_count_); } // Returns true if and only if this expectation is over-saturated. - bool IsOverSaturated() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { + bool IsOverSaturated() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); return cardinality().IsOverSaturatedByCallCount(call_count_); } @@ -826,15 +815,13 @@ class GTEST_API_ ExpectationBase { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); // Returns the number this expectation has been invoked. - int call_count() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { + int call_count() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); return call_count_; } // Increments the number this expectation has been invoked. - void IncrementCallCount() - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { + void IncrementCallCount() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); call_count_++; } @@ -843,8 +830,7 @@ class GTEST_API_ ExpectationBase { // WillRepeatedly() clauses) against the cardinality if this hasn't // been done before. Prints a warning if there are too many or too // few actions. - void CheckActionCountIfNotDone() const - GTEST_LOCK_EXCLUDED_(mutex_); + void CheckActionCountIfNotDone() const GTEST_LOCK_EXCLUDED_(mutex_); friend class ::testing::Sequence; friend class ::testing::internal::ExpectationTester; @@ -857,12 +843,12 @@ class GTEST_API_ ExpectationBase { // This group of fields are part of the spec and won't change after // an EXPECT_CALL() statement finishes. - const char* file_; // The file that contains the expectation. - int line_; // The line number of the expectation. + const char* file_; // The file that contains the expectation. + int line_; // The line number of the expectation. const std::string source_text_; // The EXPECT_CALL(...) source text. // True if and only if the cardinality is specified explicitly. bool cardinality_specified_; - Cardinality cardinality_; // The cardinality of the expectation. + Cardinality cardinality_; // The cardinality of the expectation. // The immediate pre-requisites (i.e. expectations that must be // satisfied before this expectation can be matched) of this // expectation. We use std::shared_ptr in the set because we want an @@ -881,7 +867,7 @@ class GTEST_API_ ExpectationBase { bool retires_on_saturation_; Clause last_clause_; mutable bool action_count_checked_; // Under mutex_. - mutable Mutex mutex_; // Protects action_count_checked_. + mutable Mutex mutex_; // Protects action_count_checked_. }; // class ExpectationBase // Impements an expectation for the given function type. @@ -939,9 +925,7 @@ class TypedExpectation : public ExpectationBase { } // Implements the .Times() clause. - TypedExpectation& Times(int n) { - return Times(Exactly(n)); - } + TypedExpectation& Times(int n) { return Times(Exactly(n)); } // Implements the .InSequence() clause. TypedExpectation& InSequence(const Sequence& s) { @@ -1056,9 +1040,7 @@ class TypedExpectation : public ExpectationBase { // Returns the matchers for the arguments as specified inside the // EXPECT_CALL() macro. - const ArgumentMatcherTuple& matchers() const { - return matchers_; - } + const ArgumentMatcherTuple& matchers() const { return matchers_; } // Returns the matcher specified by the .With() clause. const Matcher& extra_matcher() const { @@ -1113,10 +1095,8 @@ class TypedExpectation : public ExpectationBase { // Describes the result of matching the arguments against this // expectation to the given ostream. - void ExplainMatchResultTo( - const ArgumentTuple& args, - ::std::ostream* os) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { + void ExplainMatchResultTo(const ArgumentTuple& args, ::std::ostream* os) const + GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); if (is_retired()) { @@ -1175,9 +1155,9 @@ class TypedExpectation : public ExpectationBase { ::std::stringstream ss; DescribeLocationTo(&ss); ss << "Actions ran out in " << source_text() << "...\n" - << "Called " << count << " times, but only " - << action_count << " WillOnce()" - << (action_count == 1 ? " is" : "s are") << " specified - "; + << "Called " << count << " times, but only " << action_count + << " WillOnce()" << (action_count == 1 ? " is" : "s are") + << " specified - "; mocker->DescribeDefaultActionTo(args, &ss); Log(kWarning, ss.str(), 1); } @@ -1219,7 +1199,7 @@ class TypedExpectation : public ExpectationBase { } // Must be done after IncrementCount()! - *what << "Mock function call matches " << source_text() <<"...\n"; + *what << "Mock function call matches " << source_text() << "...\n"; return &(GetCurrentAction(mocker, args)); } @@ -1252,8 +1232,8 @@ template class MockSpec { public: typedef typename internal::Function::ArgumentTuple ArgumentTuple; - typedef typename internal::Function::ArgumentMatcherTuple - ArgumentMatcherTuple; + typedef + typename internal::Function::ArgumentMatcherTuple ArgumentMatcherTuple; // Constructs a MockSpec object, given the function mocker object // that the spec is associated with. @@ -1263,8 +1243,9 @@ class MockSpec { // Adds a new default action spec to the function mocker and returns // the newly created spec. - internal::OnCallSpec& InternalDefaultActionSetAt( - const char* file, int line, const char* obj, const char* call) { + internal::OnCallSpec& InternalDefaultActionSetAt(const char* file, + int line, const char* obj, + const char* call) { LogWithLocation(internal::kInfo, file, line, std::string("ON_CALL(") + obj + ", " + call + ") invoked"); return function_mocker_->AddNewOnCallSpec(file, line, matchers_); @@ -1272,13 +1253,14 @@ class MockSpec { // Adds a new expectation spec to the function mocker and returns // the newly created spec. - internal::TypedExpectation& InternalExpectedAt( - const char* file, int line, const char* obj, const char* call) { + internal::TypedExpectation& InternalExpectedAt(const char* file, int line, + const char* obj, + const char* call) { const std::string source_text(std::string("EXPECT_CALL(") + obj + ", " + call + ")"); LogWithLocation(internal::kInfo, file, line, source_text + " invoked"); - return function_mocker_->AddNewExpectation( - file, line, source_text, matchers_); + return function_mocker_->AddNewExpectation(file, line, source_text, + matchers_); } // This operator overload is used to swallow the superfluous parameter list @@ -1311,9 +1293,7 @@ template class ReferenceOrValueWrapper { public: // Constructs a wrapper from the given value/reference. - explicit ReferenceOrValueWrapper(T value) - : value_(std::move(value)) { - } + explicit ReferenceOrValueWrapper(T value) : value_(std::move(value)) {} // Unwraps and returns the underlying value/reference, exactly as // originally passed. The behavior of calling this more than once on @@ -1324,9 +1304,7 @@ class ReferenceOrValueWrapper { // Always returns a const reference (more precisely, // const std::add_lvalue_reference::type). The behavior of calling this // after calling Unwrap on the same object is unspecified. - const T& Peek() const { - return value_; - } + const T& Peek() const { return value_; } private: T value_; @@ -1340,8 +1318,7 @@ class ReferenceOrValueWrapper { // Workaround for debatable pass-by-reference lint warning (c-library-team // policy precludes NOLINT in this context) typedef T& reference; - explicit ReferenceOrValueWrapper(reference ref) - : value_ptr_(&ref) {} + explicit ReferenceOrValueWrapper(reference ref) : value_ptr_(&ref) {} T& Unwrap() { return *value_ptr_; } const T& Peek() const { return *value_ptr_; } @@ -1371,9 +1348,7 @@ template class ActionResultHolder : public UntypedActionResultHolderBase { public: // Returns the held value. Must not be called more than once. - T Unwrap() { - return result_.Unwrap(); - } + T Unwrap() { return result_.Unwrap(); } // Prints the held value as an action's result to os. void PrintAsActionResult(::std::ostream* os) const override { @@ -1389,8 +1364,8 @@ class ActionResultHolder : public UntypedActionResultHolderBase { const FunctionMocker* func_mocker, typename Function::ArgumentTuple&& args, const std::string& call_description) { - return new ActionResultHolder(Wrapper(func_mocker->PerformDefaultAction( - std::move(args), call_description))); + return new ActionResultHolder(Wrapper( + func_mocker->PerformDefaultAction(std::move(args), call_description))); } // Performs the given action and returns the result in a new-ed @@ -1398,16 +1373,13 @@ class ActionResultHolder : public UntypedActionResultHolderBase { template static ActionResultHolder* PerformAction( const Action& action, typename Function::ArgumentTuple&& args) { - return new ActionResultHolder( - Wrapper(action.Perform(std::move(args)))); + return new ActionResultHolder(Wrapper(action.Perform(std::move(args)))); } private: typedef ReferenceOrValueWrapper Wrapper; - explicit ActionResultHolder(Wrapper result) - : result_(std::move(result)) { - } + explicit ActionResultHolder(Wrapper result) : result_(std::move(result)) {} Wrapper result_; @@ -1418,7 +1390,7 @@ class ActionResultHolder : public UntypedActionResultHolderBase { template <> class ActionResultHolder : public UntypedActionResultHolderBase { public: - void Unwrap() { } + void Unwrap() {} void PrintAsActionResult(::std::ostream* /* os */) const override {} @@ -1489,14 +1461,12 @@ class FunctionMocker final : public UntypedFunctionMockerBase { // Returns the ON_CALL spec that matches this mock function with the // given arguments; returns NULL if no matching ON_CALL is found. // L = * - const OnCallSpec* FindOnCallSpec( - const ArgumentTuple& args) const { - for (UntypedOnCallSpecs::const_reverse_iterator it - = untyped_on_call_specs_.rbegin(); + const OnCallSpec* FindOnCallSpec(const ArgumentTuple& args) const { + for (UntypedOnCallSpecs::const_reverse_iterator it = + untyped_on_call_specs_.rbegin(); it != untyped_on_call_specs_.rend(); ++it) { const OnCallSpec* spec = static_cast*>(*it); - if (spec->Matches(args)) - return spec; + if (spec->Matches(args)) return spec; } return nullptr; @@ -1511,8 +1481,7 @@ class FunctionMocker final : public UntypedFunctionMockerBase { // L = * Result PerformDefaultAction(ArgumentTuple&& args, const std::string& call_description) const { - const OnCallSpec* const spec = - this->FindOnCallSpec(args); + const OnCallSpec* const spec = this->FindOnCallSpec(args); if (spec != nullptr) { return spec->GetAction().Perform(std::move(args)); } @@ -1573,8 +1542,7 @@ class FunctionMocker final : public UntypedFunctionMockerBase { untyped_on_call_specs_.swap(specs_to_delete); g_gmock_mutex.Unlock(); - for (UntypedOnCallSpecs::const_iterator it = - specs_to_delete.begin(); + for (UntypedOnCallSpecs::const_iterator it = specs_to_delete.begin(); it != specs_to_delete.end(); ++it) { delete static_cast*>(*it); } @@ -1605,10 +1573,9 @@ class FunctionMocker final : public UntypedFunctionMockerBase { typedef ActionResultHolder ResultHolder; // Adds and returns a default action spec for this mock function. - OnCallSpec& AddNewOnCallSpec( - const char* file, int line, - const ArgumentMatcherTuple& m) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { + OnCallSpec& AddNewOnCallSpec(const char* file, int line, + const ArgumentMatcherTuple& m) + GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line); OnCallSpec* const on_call_spec = new OnCallSpec(file, line, m); untyped_on_call_specs_.push_back(on_call_spec); @@ -1638,7 +1605,8 @@ class FunctionMocker final : public UntypedFunctionMockerBase { } private: - template friend class TypedExpectation; + template + friend class TypedExpectation; // Some utilities needed for implementing UntypedInvokeWith(). @@ -1722,9 +1690,8 @@ class FunctionMocker final : public UntypedFunctionMockerBase { // Returns the expectation that matches the arguments, or NULL if no // expectation matches them. - TypedExpectation* FindMatchingExpectationLocked( - const ArgumentTuple& args) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { + TypedExpectation* FindMatchingExpectationLocked(const ArgumentTuple& args) + const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); // See the definition of untyped_expectations_ for why access to // it is unprotected here. @@ -1741,11 +1708,10 @@ class FunctionMocker final : public UntypedFunctionMockerBase { } // Returns a message that the arguments don't match any expectation. - void FormatUnexpectedCallMessageLocked( - const ArgumentTuple& args, - ::std::ostream* os, - ::std::ostream* why) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { + void FormatUnexpectedCallMessageLocked(const ArgumentTuple& args, + ::std::ostream* os, + ::std::ostream* why) const + GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); *os << "\nUnexpected mock function call - "; DescribeDefaultActionTo(args, os); @@ -1754,15 +1720,14 @@ class FunctionMocker final : public UntypedFunctionMockerBase { // Prints a list of expectations that have been tried against the // current mock function call. - void PrintTriedExpectationsLocked( - const ArgumentTuple& args, - ::std::ostream* why) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { + void PrintTriedExpectationsLocked(const ArgumentTuple& args, + ::std::ostream* why) const + GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); const size_t count = untyped_expectations_.size(); *why << "Google Mock tried the following " << count << " " - << (count == 1 ? "expectation, but it didn't match" : - "expectations, but none matched") + << (count == 1 ? "expectation, but it didn't match" + : "expectations, but none matched") << ":\n"; for (size_t i = 0; i < count; i++) { TypedExpectation* const expectation = @@ -1944,7 +1909,9 @@ using internal::MockSpec; // // Expects a call to const MockFoo::Bar(). // EXPECT_CALL(Const(foo), Bar()); template -inline const T& Const(const T& x) { return x; } +inline const T& Const(const T& x) { + return x; +} // Constructs an Expectation object that references and co-owns exp. inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT diff --git a/Testing/lib/googletest-master/googlemock/include/gmock/gmock.h b/Testing/lib/googletest-master/googlemock/include/gmock/gmock.h index 3c317b6d4..47a0267a3 100644 --- a/Testing/lib/googletest-master/googlemock/include/gmock/gmock.h +++ b/Testing/lib/googletest-master/googlemock/include/gmock/gmock.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // This is the main header file a user should include. diff --git a/Testing/lib/googletest-master/googlemock/include/gmock/internal/gmock-internal-utils.h b/Testing/lib/googletest-master/googlemock/include/gmock/internal/gmock-internal-utils.h index 5580dcb38..0a20c2cf9 100644 --- a/Testing/lib/googletest-master/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/Testing/lib/googletest-master/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // This file defines some utilities useful for implementing Google @@ -40,9 +39,11 @@ #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ #include + #include // NOLINT #include #include + #include "gmock/internal/gmock-port.h" #include "gtest/gtest.h" @@ -56,9 +57,9 @@ namespace internal { // Silence MSVC C4100 (unreferenced formal parameter) and // C4805('==': unsafe mix of type 'const int' and type 'const bool') #ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) -# pragma warning(disable:4805) +#pragma warning(push) +#pragma warning(disable : 4100) +#pragma warning(disable : 4805) #endif // Joins a vector of strings as if they are fields of a tuple; returns @@ -83,7 +84,9 @@ struct PointeeOf { }; // This specialization is for the raw pointer case. template -struct PointeeOf { typedef T type; }; // NOLINT +struct PointeeOf { + typedef T type; +}; // NOLINT // GetRawPointer(p) returns the raw pointer underlying p when p is a // smart pointer, or returns p itself when p is already a raw pointer. @@ -94,7 +97,9 @@ inline const typename Pointer::element_type* GetRawPointer(const Pointer& p) { } // This overloaded version is for the raw pointer case. template -inline Element* GetRawPointer(Element* p) { return p; } +inline Element* GetRawPointer(Element* p) { + return p; +} // MSVC treats wchar_t as a native type usually, but treats it as the // same as unsigned short when the compiler option /Zc:wchar_t- is @@ -103,7 +108,7 @@ inline Element* GetRawPointer(Element* p) { return p; } #if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED) // wchar_t is a typedef. #else -# define GMOCK_WCHAR_T_IS_NATIVE_ 1 +#define GMOCK_WCHAR_T_IS_NATIVE_ 1 #endif // In what follows, we use the term "kind" to indicate whether a type @@ -111,18 +116,20 @@ inline Element* GetRawPointer(Element* p) { return p; } // or none of them. This categorization is useful for determining // when a matcher argument type can be safely converted to another // type in the implementation of SafeMatcherCast. -enum TypeKind { - kBool, kInteger, kFloatingPoint, kOther -}; +enum TypeKind { kBool, kInteger, kFloatingPoint, kOther }; // KindOf::value is the kind of type T. -template struct KindOf { +template +struct KindOf { enum { value = kOther }; // The default kind. }; // This macro declares that the kind of 'type' is 'kind'. #define GMOCK_DECLARE_KIND_(type, kind) \ - template <> struct KindOf { enum { value = kind }; } + template <> \ + struct KindOf { \ + enum { value = kind }; \ + } GMOCK_DECLARE_KIND_(bool, kBool); @@ -130,13 +137,13 @@ GMOCK_DECLARE_KIND_(bool, kBool); GMOCK_DECLARE_KIND_(char, kInteger); GMOCK_DECLARE_KIND_(signed char, kInteger); GMOCK_DECLARE_KIND_(unsigned char, kInteger); -GMOCK_DECLARE_KIND_(short, kInteger); // NOLINT +GMOCK_DECLARE_KIND_(short, kInteger); // NOLINT GMOCK_DECLARE_KIND_(unsigned short, kInteger); // NOLINT GMOCK_DECLARE_KIND_(int, kInteger); GMOCK_DECLARE_KIND_(unsigned int, kInteger); -GMOCK_DECLARE_KIND_(long, kInteger); // NOLINT -GMOCK_DECLARE_KIND_(unsigned long, kInteger); // NOLINT -GMOCK_DECLARE_KIND_(long long, kInteger); // NOLINT +GMOCK_DECLARE_KIND_(long, kInteger); // NOLINT +GMOCK_DECLARE_KIND_(unsigned long, kInteger); // NOLINT +GMOCK_DECLARE_KIND_(long long, kInteger); // NOLINT GMOCK_DECLARE_KIND_(unsigned long long, kInteger); // NOLINT #if GMOCK_WCHAR_T_IS_NATIVE_ @@ -151,7 +158,7 @@ GMOCK_DECLARE_KIND_(long double, kFloatingPoint); #undef GMOCK_DECLARE_KIND_ // Evaluates to the kind of 'type'. -#define GMOCK_KIND_OF_(type) \ +#define GMOCK_KIND_OF_(type) \ static_cast< ::testing::internal::TypeKind>( \ ::testing::internal::KindOf::value) @@ -207,9 +214,7 @@ using LosslessArithmeticConvertible = class FailureReporterInterface { public: // The type of a failure (either non-fatal or fatal). - enum FailureType { - kNonfatal, kFatal - }; + enum FailureType { kNonfatal, kFatal }; virtual ~FailureReporterInterface() {} @@ -229,8 +234,8 @@ GTEST_API_ FailureReporterInterface* GetFailureReporter(); inline void Assert(bool condition, const char* file, int line, const std::string& msg) { if (!condition) { - GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal, - file, line, msg); + GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal, file, + line, msg); } } inline void Assert(bool condition, const char* file, int line) { @@ -251,10 +256,7 @@ inline void Expect(bool condition, const char* file, int line) { } // Severity level of a log. -enum LogSeverity { - kInfo = 0, - kWarning = 1 -}; +enum LogSeverity { kInfo = 0, kWarning = 1 }; // Valid values for the --gmock_verbose flag. @@ -297,8 +299,8 @@ GTEST_API_ WithoutMatchers GetWithoutMatchers(); // Disable MSVC warnings for infinite recursion, since in this case the // the recursion is unreachable. #ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4717) +#pragma warning(push) +#pragma warning(disable : 4717) #endif // Invalid() is usable as an expression of type T, but will terminate @@ -316,7 +318,7 @@ inline T Invalid() { } #ifdef _MSC_VER -# pragma warning(pop) +#pragma warning(pop) #endif // Given a raw type (i.e. having no top-level reference or const @@ -394,7 +396,8 @@ class StlContainerView< ::std::tuple > { // The following specialization prevents the user from instantiating // StlContainer with a reference type. -template class StlContainerView; +template +class StlContainerView; // A type transform to remove constness from the first part of a pair. // Pairs like that are used as the value_type of associative containers, @@ -415,17 +418,19 @@ struct RemoveConstFromKey > { GTEST_API_ void IllegalDoDefault(const char* file, int line); template -auto ApplyImpl(F&& f, Tuple&& args, IndexSequence) -> decltype( - std::forward(f)(std::get(std::forward(args))...)) { +auto ApplyImpl(F&& f, Tuple&& args, IndexSequence) + -> decltype(std::forward(f)( + std::get(std::forward(args))...)) { return std::forward(f)(std::get(std::forward(args))...); } // Apply the function to a tuple of arguments. template -auto Apply(F&& f, Tuple&& args) -> decltype( - ApplyImpl(std::forward(f), std::forward(args), - MakeIndexSequence::type>::value>())) { +auto Apply(F&& f, Tuple&& args) + -> decltype(ApplyImpl( + std::forward(f), std::forward(args), + MakeIndexSequence::type>::value>())) { return ApplyImpl(std::forward(f), std::forward(args), MakeIndexSequence::type>::value>()); @@ -463,7 +468,7 @@ template constexpr size_t Function::ArgumentCount; #ifdef _MSC_VER -# pragma warning(pop) +#pragma warning(pop) #endif } // namespace internal diff --git a/Testing/lib/googletest-master/googlemock/include/gmock/internal/gmock-port.h b/Testing/lib/googletest-master/googlemock/include/gmock/internal/gmock-port.h index 70872ef39..d0262780e 100644 --- a/Testing/lib/googletest-master/googlemock/include/gmock/internal/gmock-port.h +++ b/Testing/lib/googletest-master/googlemock/include/gmock/internal/gmock-port.h @@ -42,6 +42,7 @@ #include #include + #include #include @@ -53,13 +54,13 @@ // here, as Google Mock depends on Google Test. Only add a utility // here if it's truly specific to Google Mock. -#include "gtest/internal/gtest-port.h" #include "gmock/internal/custom/gmock-port.h" +#include "gtest/internal/gtest-port.h" // For MS Visual C++, check the compiler version. At least VS 2015 is // required to compile Google Mock. #if defined(_MSC_VER) && _MSC_VER < 1900 -# error "At least Visual C++ 2015 (14.0) is required to compile Google Mock." +#error "At least Visual C++ 2015 (14.0) is required to compile Google Mock." #endif // Macro for referencing flags. This is public as we want the user to @@ -69,18 +70,18 @@ #if !defined(GMOCK_DECLARE_bool_) // Macros for declaring flags. -# define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name) -# define GMOCK_DECLARE_int32_(name) extern GTEST_API_ int32_t GMOCK_FLAG(name) -# define GMOCK_DECLARE_string_(name) \ - extern GTEST_API_ ::std::string GMOCK_FLAG(name) +#define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name) +#define GMOCK_DECLARE_int32_(name) extern GTEST_API_ int32_t GMOCK_FLAG(name) +#define GMOCK_DECLARE_string_(name) \ + extern GTEST_API_ ::std::string GMOCK_FLAG(name) // Macros for defining flags. -# define GMOCK_DEFINE_bool_(name, default_val, doc) \ - GTEST_API_ bool GMOCK_FLAG(name) = (default_val) -# define GMOCK_DEFINE_int32_(name, default_val, doc) \ - GTEST_API_ int32_t GMOCK_FLAG(name) = (default_val) -# define GMOCK_DEFINE_string_(name, default_val, doc) \ - GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val) +#define GMOCK_DEFINE_bool_(name, default_val, doc) \ + GTEST_API_ bool GMOCK_FLAG(name) = (default_val) +#define GMOCK_DEFINE_int32_(name, default_val, doc) \ + GTEST_API_ int32_t GMOCK_FLAG(name) = (default_val) +#define GMOCK_DEFINE_string_(name, default_val, doc) \ + GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val) #endif // !defined(GMOCK_DECLARE_bool_) diff --git a/Testing/lib/googletest-master/googlemock/test/gmock_link_test.h b/Testing/lib/googletest-master/googlemock/test/gmock_link_test.h index 175d2bdd1..69ac0f47c 100644 --- a/Testing/lib/googletest-master/googlemock/test/gmock_link_test.h +++ b/Testing/lib/googletest-master/googlemock/test/gmock_link_test.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Mock - a framework for writing C++ mock classes. // // This file tests that: @@ -118,7 +117,7 @@ #include "gmock/gmock.h" #if !GTEST_OS_WINDOWS_MOBILE -# include +#include #endif #include @@ -200,14 +199,14 @@ class Interface { virtual char* StringFromString(char* str) = 0; virtual int IntFromString(char* str) = 0; virtual int& IntRefFromString(char* str) = 0; - virtual void VoidFromFunc(void(*func)(char* str)) = 0; + virtual void VoidFromFunc(void (*func)(char* str)) = 0; virtual void VoidFromIntRef(int& n) = 0; // NOLINT virtual void VoidFromFloat(float n) = 0; virtual void VoidFromDouble(double n) = 0; virtual void VoidFromVector(const std::vector& v) = 0; }; -class Mock: public Interface { +class Mock : public Interface { public: Mock() {} @@ -215,7 +214,7 @@ class Mock: public Interface { MOCK_METHOD1(StringFromString, char*(char* str)); MOCK_METHOD1(IntFromString, int(char* str)); MOCK_METHOD1(IntRefFromString, int&(char* str)); - MOCK_METHOD1(VoidFromFunc, void(void(*func)(char* str))); + MOCK_METHOD1(VoidFromFunc, void(void (*func)(char* str))); MOCK_METHOD1(VoidFromIntRef, void(int& n)); // NOLINT MOCK_METHOD1(VoidFromFloat, void(float n)); MOCK_METHOD1(VoidFromDouble, void(double n)); @@ -301,8 +300,8 @@ TEST(LinkTest, TestSetArrayArgument) { char ch = 'x'; char ch2 = 'y'; - EXPECT_CALL(mock, VoidFromString(_)).WillOnce(SetArrayArgument<0>(&ch2, - &ch2 + 1)); + EXPECT_CALL(mock, VoidFromString(_)) + .WillOnce(SetArrayArgument<0>(&ch2, &ch2 + 1)); mock.VoidFromString(&ch); } @@ -339,8 +338,8 @@ TEST(LinkTest, TestInvokeWithoutArgs) { EXPECT_CALL(mock, VoidFromString(_)) .WillOnce(InvokeWithoutArgs(&InvokeHelper::StaticVoidFromVoid)) - .WillOnce(InvokeWithoutArgs(&test_invoke_helper, - &InvokeHelper::VoidFromVoid)); + .WillOnce( + InvokeWithoutArgs(&test_invoke_helper, &InvokeHelper::VoidFromVoid)); mock.VoidFromString(nullptr); mock.VoidFromString(nullptr); } @@ -424,14 +423,14 @@ TEST(LinkTest, TestThrow) { // is expanded and macro expansion cannot contain #pragma. Therefore // we suppress them here. #ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) +#pragma warning(push) +#pragma warning(disable : 4100) #endif // Tests the linkage of actions created using ACTION macro. namespace { ACTION(Return1) { return 1; } -} +} // namespace TEST(LinkTest, TestActionMacro) { Mock mock; @@ -443,7 +442,7 @@ TEST(LinkTest, TestActionMacro) { // Tests the linkage of actions created using ACTION_P macro. namespace { ACTION_P(ReturnArgument, ret_value) { return ret_value; } -} +} // namespace TEST(LinkTest, TestActionPMacro) { Mock mock; @@ -457,10 +456,10 @@ namespace { ACTION_P2(ReturnEqualsEitherOf, first, second) { return arg0 == first || arg0 == second; } -} +} // namespace #ifdef _MSC_VER -# pragma warning(pop) +#pragma warning(pop) #endif TEST(LinkTest, TestActionP2Macro) { @@ -492,8 +491,7 @@ TEST(LinkTest, TestMatchersEq) { const char* p = "x"; ON_CALL(mock, VoidFromString(Eq(p))).WillByDefault(Return()); - ON_CALL(mock, VoidFromString(const_cast("y"))) - .WillByDefault(Return()); + ON_CALL(mock, VoidFromString(const_cast("y"))).WillByDefault(Return()); } // Tests the linkage of the Lt, Gt, Le, Ge, and Ne matchers. @@ -592,7 +590,7 @@ TEST(LinkTest, TestMatcherElementsAre) { // Tests the linkage of the ElementsAreArray matcher. TEST(LinkTest, TestMatcherElementsAreArray) { Mock mock; - char arr[] = { 'a', 'b' }; + char arr[] = {'a', 'b'}; ON_CALL(mock, VoidFromVector(ElementsAreArray(arr))).WillByDefault(Return()); } diff --git a/Testing/lib/googletest-master/googletest/generated/GTestConfigVersion.cmake b/Testing/lib/googletest-master/googletest/generated/GTestConfigVersion.cmake index fb8e2b9b9..86deec32d 100644 --- a/Testing/lib/googletest-master/googletest/generated/GTestConfigVersion.cmake +++ b/Testing/lib/googletest-master/googletest/generated/GTestConfigVersion.cmake @@ -9,12 +9,23 @@ set(PACKAGE_VERSION "1.10.0") -if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) - set(PACKAGE_VERSION_COMPATIBLE FALSE) +if (PACKAGE_FIND_VERSION_RANGE) + # Package version must be in the requested version range + if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN) + OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX) + OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX))) + set(PACKAGE_VERSION_COMPATIBLE FALSE) + else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + endif() else() - set(PACKAGE_VERSION_COMPATIBLE TRUE) - if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) - set(PACKAGE_VERSION_EXACT TRUE) + if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE FALSE) + else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() endif() endif() diff --git a/Testing/lib/googletest-master/googletest/generated/gmock.pc b/Testing/lib/googletest-master/googletest/generated/gmock.pc index 76c5f393d..f3a1d78b8 100644 --- a/Testing/lib/googletest-master/googletest/generated/gmock.pc +++ b/Testing/lib/googletest-master/googletest/generated/gmock.pc @@ -1,4 +1,4 @@ -libdir=/usr/local/lib64 +libdir=/usr/local/lib includedir=/usr/local/include Name: gmock diff --git a/Testing/lib/googletest-master/googletest/generated/gmock_main.pc b/Testing/lib/googletest-master/googletest/generated/gmock_main.pc index 8bedb1396..c789a070f 100644 --- a/Testing/lib/googletest-master/googletest/generated/gmock_main.pc +++ b/Testing/lib/googletest-master/googletest/generated/gmock_main.pc @@ -1,4 +1,4 @@ -libdir=/usr/local/lib64 +libdir=/usr/local/lib includedir=/usr/local/include Name: gmock_main diff --git a/Testing/lib/googletest-master/googletest/generated/gtest.pc b/Testing/lib/googletest-master/googletest/generated/gtest.pc index 324dc42b9..d713ba5e1 100644 --- a/Testing/lib/googletest-master/googletest/generated/gtest.pc +++ b/Testing/lib/googletest-master/googletest/generated/gtest.pc @@ -1,4 +1,4 @@ -libdir=/usr/local/lib64 +libdir=/usr/local/lib includedir=/usr/local/include Name: gtest diff --git a/Testing/lib/googletest-master/googletest/generated/gtest_main.pc b/Testing/lib/googletest-master/googletest/generated/gtest_main.pc index de12a9c75..2350bd585 100644 --- a/Testing/lib/googletest-master/googletest/generated/gtest_main.pc +++ b/Testing/lib/googletest-master/googletest/generated/gtest_main.pc @@ -1,4 +1,4 @@ -libdir=/usr/local/lib64 +libdir=/usr/local/lib includedir=/usr/local/include Name: gtest_main diff --git a/Testing/lib/googletest-master/googletest/include/gtest/gtest-death-test.h b/Testing/lib/googletest-master/googletest/include/gtest/gtest-death-test.h index 2bd41cf38..d6a9e152d 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/gtest-death-test.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/gtest-death-test.h @@ -165,24 +165,24 @@ GTEST_API_ bool InDeathTestChild(); // Asserts that a given statement causes the program to exit, with an // integer exit status that satisfies predicate, and emitting error output // that matches regex. -# define ASSERT_EXIT(statement, predicate, regex) \ - GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_) +#define ASSERT_EXIT(statement, predicate, regex) \ + GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_) // Like ASSERT_EXIT, but continues on to successive tests in the // test suite, if any: -# define EXPECT_EXIT(statement, predicate, regex) \ - GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_) +#define EXPECT_EXIT(statement, predicate, regex) \ + GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_) // Asserts that a given statement causes the program to exit, either by // explicitly exiting with a nonzero exit code or being killed by a // signal, and emitting error output that matches regex. -# define ASSERT_DEATH(statement, regex) \ - ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex) +#define ASSERT_DEATH(statement, regex) \ + ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex) // Like ASSERT_DEATH, but continues on to successive tests in the // test suite, if any: -# define EXPECT_DEATH(statement, regex) \ - EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex) +#define EXPECT_DEATH(statement, regex) \ + EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex) // Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*: @@ -193,11 +193,12 @@ class GTEST_API_ ExitedWithCode { ExitedWithCode(const ExitedWithCode&) = default; void operator=(const ExitedWithCode& other) = delete; bool operator()(int exit_status) const; + private: const int exit_code_; }; -# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA +#if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA // Tests that an exit code describes an exit due to termination by a // given signal. // GOOGLETEST_CM0006 DO NOT DELETE @@ -205,10 +206,11 @@ class GTEST_API_ KilledBySignal { public: explicit KilledBySignal(int signum); bool operator()(int exit_status) const; + private: const int signum_; }; -# endif // !GTEST_OS_WINDOWS +#endif // !GTEST_OS_WINDOWS // EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode. // The death testing framework causes this to have interesting semantics, @@ -253,23 +255,21 @@ class GTEST_API_ KilledBySignal { // EXPECT_EQ(12, DieInDebugOr12(&sideeffect)); // }, "death"); // -# ifdef NDEBUG +#ifdef NDEBUG -# define EXPECT_DEBUG_DEATH(statement, regex) \ +#define EXPECT_DEBUG_DEATH(statement, regex) \ GTEST_EXECUTE_STATEMENT_(statement, regex) -# define ASSERT_DEBUG_DEATH(statement, regex) \ +#define ASSERT_DEBUG_DEATH(statement, regex) \ GTEST_EXECUTE_STATEMENT_(statement, regex) -# else +#else -# define EXPECT_DEBUG_DEATH(statement, regex) \ - EXPECT_DEATH(statement, regex) +#define EXPECT_DEBUG_DEATH(statement, regex) EXPECT_DEATH(statement, regex) -# define ASSERT_DEBUG_DEATH(statement, regex) \ - ASSERT_DEATH(statement, regex) +#define ASSERT_DEBUG_DEATH(statement, regex) ASSERT_DEATH(statement, regex) -# endif // NDEBUG for EXPECT_DEBUG_DEATH +#endif // NDEBUG for EXPECT_DEBUG_DEATH #endif // GTEST_HAS_DEATH_TEST // This macro is used for implementing macros such as @@ -307,18 +307,17 @@ class GTEST_API_ KilledBySignal { // statement unconditionally returns or throws. The Message constructor at // the end allows the syntax of streaming additional messages into the // macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH. -# define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AlwaysTrue()) { \ - GTEST_LOG_(WARNING) \ - << "Death tests are not supported on this platform.\n" \ - << "Statement '" #statement "' cannot be verified."; \ - } else if (::testing::internal::AlwaysFalse()) { \ - ::testing::internal::RE::PartialMatch(".*", (regex)); \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - terminator; \ - } else \ - ::testing::Message() +#define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \ + GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ + if (::testing::internal::AlwaysTrue()) { \ + GTEST_LOG_(WARNING) << "Death tests are not supported on this platform.\n" \ + << "Statement '" #statement "' cannot be verified."; \ + } else if (::testing::internal::AlwaysFalse()) { \ + ::testing::internal::RE::PartialMatch(".*", (regex)); \ + GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ + terminator; \ + } else \ + ::testing::Message() // EXPECT_DEATH_IF_SUPPORTED(statement, regex) and // ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if @@ -326,15 +325,15 @@ class GTEST_API_ KilledBySignal { // useful when you are combining death test assertions with normal test // assertions in one test. #if GTEST_HAS_DEATH_TEST -# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ - EXPECT_DEATH(statement, regex) -# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ - ASSERT_DEATH(statement, regex) +#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ + EXPECT_DEATH(statement, regex) +#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ + ASSERT_DEATH(statement, regex) #else -# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ - GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, ) -# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ - GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return) +#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ + GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, ) +#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ + GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return) #endif } // namespace testing diff --git a/Testing/lib/googletest-master/googletest/include/gtest/gtest-matchers.h b/Testing/lib/googletest-master/googletest/include/gtest/gtest-matchers.h index 3b2d0f501..53d076efe 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/gtest-matchers.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/gtest-matchers.h @@ -108,8 +108,7 @@ class MatchResultListener { GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener); }; -inline MatchResultListener::~MatchResultListener() { -} +inline MatchResultListener::~MatchResultListener() {} // An instance of a subclass of this knows how to describe itself as a // matcher. @@ -208,27 +207,39 @@ class MatcherInterfaceAdapter : public MatcherInterface { struct AnyEq { template - bool operator()(const A& a, const B& b) const { return a == b; } + bool operator()(const A& a, const B& b) const { + return a == b; + } }; struct AnyNe { template - bool operator()(const A& a, const B& b) const { return a != b; } + bool operator()(const A& a, const B& b) const { + return a != b; + } }; struct AnyLt { template - bool operator()(const A& a, const B& b) const { return a < b; } + bool operator()(const A& a, const B& b) const { + return a < b; + } }; struct AnyGt { template - bool operator()(const A& a, const B& b) const { return a > b; } + bool operator()(const A& a, const B& b) const { + return a > b; + } }; struct AnyLe { template - bool operator()(const A& a, const B& b) const { return a <= b; } + bool operator()(const A& a, const B& b) const { + return a <= b; + } }; struct AnyGe { template - bool operator()(const A& a, const B& b) const { return a >= b; } + bool operator()(const A& a, const B& b) const { + return a >= b; + } }; // A match result listener that ignores the explanation. @@ -287,9 +298,7 @@ class MatcherBase { // Returns the describer for this matcher object; retains ownership // of the describer, which is only guaranteed to be alive when // this matcher object is alive. - const MatcherDescriberInterface* GetDescriber() const { - return impl_.get(); - } + const MatcherDescriberInterface* GetDescriber() const { return impl_.get(); } protected: MatcherBase() {} @@ -536,9 +545,13 @@ class ComparisonBase { private: template - static const T& Unwrap(const T& v) { return v; } + static const T& Unwrap(const T& v) { + return v; + } template - static const T& Unwrap(std::reference_wrapper v) { return v; } + static const T& Unwrap(std::reference_wrapper v) { + return v; + } template class Impl : public MatcherInterface { @@ -553,7 +566,7 @@ class ComparisonBase { UniversalPrint(Unwrap(rhs_), os); } void DescribeNegationTo(::std::ostream* os) const override { - *os << D::NegatedDesc() << " "; + *os << D::NegatedDesc() << " "; UniversalPrint(Unwrap(rhs_), os); } @@ -567,7 +580,7 @@ template class EqMatcher : public ComparisonBase, Rhs, AnyEq> { public: explicit EqMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyEq>(rhs) { } + : ComparisonBase, Rhs, AnyEq>(rhs) {} static const char* Desc() { return "is equal to"; } static const char* NegatedDesc() { return "isn't equal to"; } }; @@ -575,7 +588,7 @@ template class NeMatcher : public ComparisonBase, Rhs, AnyNe> { public: explicit NeMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyNe>(rhs) { } + : ComparisonBase, Rhs, AnyNe>(rhs) {} static const char* Desc() { return "isn't equal to"; } static const char* NegatedDesc() { return "is equal to"; } }; @@ -583,7 +596,7 @@ template class LtMatcher : public ComparisonBase, Rhs, AnyLt> { public: explicit LtMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyLt>(rhs) { } + : ComparisonBase, Rhs, AnyLt>(rhs) {} static const char* Desc() { return "is <"; } static const char* NegatedDesc() { return "isn't <"; } }; @@ -591,7 +604,7 @@ template class GtMatcher : public ComparisonBase, Rhs, AnyGt> { public: explicit GtMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyGt>(rhs) { } + : ComparisonBase, Rhs, AnyGt>(rhs) {} static const char* Desc() { return "is >"; } static const char* NegatedDesc() { return "isn't >"; } }; @@ -599,7 +612,7 @@ template class LeMatcher : public ComparisonBase, Rhs, AnyLe> { public: explicit LeMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyLe>(rhs) { } + : ComparisonBase, Rhs, AnyLe>(rhs) {} static const char* Desc() { return "is <="; } static const char* NegatedDesc() { return "isn't <="; } }; @@ -607,7 +620,7 @@ template class GeMatcher : public ComparisonBase, Rhs, AnyGe> { public: explicit GeMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyGe>(rhs) { } + : ComparisonBase, Rhs, AnyGe>(rhs) {} static const char* Desc() { return "is >="; } static const char* NegatedDesc() { return "isn't >="; } }; @@ -698,12 +711,16 @@ PolymorphicMatcher ContainsRegex( // Note: if the parameter of Eq() were declared as const T&, Eq("foo") // wouldn't compile. template -inline internal::EqMatcher Eq(T x) { return internal::EqMatcher(x); } +inline internal::EqMatcher Eq(T x) { + return internal::EqMatcher(x); +} // Constructs a Matcher from a 'value' of type T. The constructed // matcher matches any value that's equal to 'value'. template -Matcher::Matcher(T value) { *this = Eq(value); } +Matcher::Matcher(T value) { + *this = Eq(value); +} // Creates a monomorphic matcher that matches anything with type Lhs // and equal to rhs. A user may need to use this instead of Eq(...) @@ -718,7 +735,9 @@ Matcher::Matcher(T value) { *this = Eq(value); } // can always write Matcher(Lt(5)) to be explicit about the type, // for example. template -inline Matcher TypedEq(const Rhs& rhs) { return Eq(rhs); } +inline Matcher TypedEq(const Rhs& rhs) { + return Eq(rhs); +} // Creates a polymorphic matcher that matches anything >= x. template diff --git a/Testing/lib/googletest-master/googletest/include/gtest/gtest-message.h b/Testing/lib/googletest-master/googletest/include/gtest/gtest-message.h index 21899232a..dcf1dc79c 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/gtest-message.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/gtest-message.h @@ -110,7 +110,7 @@ class GTEST_API_ Message { // Streams a non-pointer value to this object. template - inline Message& operator <<(const T& val) { + inline Message& operator<<(const T& val) { // Some libraries overload << for STL containers. These // overloads are defined in the global namespace instead of ::std. // @@ -125,7 +125,7 @@ class GTEST_API_ Message { // from the global namespace. With this using declaration, // overloads of << defined in the global namespace and those // visible via Koenig lookup are both exposed in this function. - using ::operator <<; + using ::operator<<; *ss_ << val; return *this; } @@ -144,7 +144,7 @@ class GTEST_API_ Message { // ensure consistent result across compilers, we always treat NULL // as "(null)". template - inline Message& operator <<(T* const& pointer) { // NOLINT + inline Message& operator<<(T* const& pointer) { // NOLINT if (pointer == nullptr) { *ss_ << "(null)"; } else { @@ -159,25 +159,23 @@ class GTEST_API_ Message { // templatized version above. Without this definition, streaming // endl or other basic IO manipulators to Message will confuse the // compiler. - Message& operator <<(BasicNarrowIoManip val) { + Message& operator<<(BasicNarrowIoManip val) { *ss_ << val; return *this; } // Instead of 1/0, we want to see true/false for bool values. - Message& operator <<(bool b) { - return *this << (b ? "true" : "false"); - } + Message& operator<<(bool b) { return *this << (b ? "true" : "false"); } // These two overloads allow streaming a wide C string to a Message // using the UTF-8 encoding. - Message& operator <<(const wchar_t* wide_c_str); - Message& operator <<(wchar_t* wide_c_str); + Message& operator<<(const wchar_t* wide_c_str); + Message& operator<<(wchar_t* wide_c_str); #if GTEST_HAS_STD_WSTRING // Converts the given wide string to a narrow string using the UTF-8 // encoding, and streams the result to this Message object. - Message& operator <<(const ::std::wstring& wstr); + Message& operator<<(const ::std::wstring& wstr); #endif // GTEST_HAS_STD_WSTRING // Gets the text streamed to this object so far as an std::string. @@ -196,7 +194,7 @@ class GTEST_API_ Message { }; // Streams a Message to an ostream. -inline std::ostream& operator <<(std::ostream& os, const Message& sb) { +inline std::ostream& operator<<(std::ostream& os, const Message& sb) { return os << sb.GetString(); } diff --git a/Testing/lib/googletest-master/googletest/include/gtest/gtest-param-test.h b/Testing/lib/googletest-master/googletest/include/gtest/gtest-param-test.h index 5b039df9f..c8db1e81a 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/gtest-param-test.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/gtest-param-test.h @@ -36,7 +36,6 @@ #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ - // Value-parameterized tests allow you to test your code with different // parameters without writing multiple copies of the same test. // @@ -356,9 +355,7 @@ internal::ValueArray Values(T... v) { // } // INSTANTIATE_TEST_SUITE_P(BoolSequence, FlagDependentTest, Bool()); // -inline internal::ParamGenerator Bool() { - return Values(false, true); -} +inline internal::ParamGenerator Bool() { return Values(false, true); } // Combine() allows the user to combine two or more sequences to produce // values of a Cartesian product of those sequences' elements. @@ -457,43 +454,42 @@ internal::CartesianProductHolder Combine(const Generator&... g) { #define GTEST_GET_FIRST_(first, ...) first #define GTEST_GET_SECOND_(first, second, ...) second -#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \ - static ::testing::internal::ParamGenerator \ - gtest_##prefix##test_suite_name##_EvalGenerator_() { \ - return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \ - } \ - static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \ - const ::testing::TestParamInfo& info) { \ - if (::testing::internal::AlwaysFalse()) { \ - ::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \ - __VA_ARGS__, \ - ::testing::internal::DefaultParamName, \ - DUMMY_PARAM_))); \ - auto t = std::make_tuple(__VA_ARGS__); \ - static_assert(std::tuple_size::value <= 2, \ - "Too Many Args!"); \ - } \ - return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \ - __VA_ARGS__, \ - ::testing::internal::DefaultParamName, \ - DUMMY_PARAM_))))(info); \ - } \ - static int gtest_##prefix##test_suite_name##_dummy_ \ - GTEST_ATTRIBUTE_UNUSED_ = \ - ::testing::UnitTest::GetInstance() \ - ->parameterized_test_registry() \ - .GetTestSuitePatternHolder( \ - GTEST_STRINGIFY_(test_suite_name), \ - ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ - ->AddTestSuiteInstantiation( \ - GTEST_STRINGIFY_(prefix), \ - >est_##prefix##test_suite_name##_EvalGenerator_, \ - >est_##prefix##test_suite_name##_EvalGenerateName_, \ +#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \ + static ::testing::internal::ParamGenerator \ + gtest_##prefix##test_suite_name##_EvalGenerator_() { \ + return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \ + } \ + static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \ + const ::testing::TestParamInfo& info) { \ + if (::testing::internal::AlwaysFalse()) { \ + ::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \ + __VA_ARGS__, \ + ::testing::internal::DefaultParamName, \ + DUMMY_PARAM_))); \ + auto t = std::make_tuple(__VA_ARGS__); \ + static_assert(std::tuple_size::value <= 2, \ + "Too Many Args!"); \ + } \ + return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \ + __VA_ARGS__, \ + ::testing::internal::DefaultParamName, \ + DUMMY_PARAM_))))(info); \ + } \ + static int gtest_##prefix##test_suite_name##_dummy_ \ + GTEST_ATTRIBUTE_UNUSED_ = \ + ::testing::UnitTest::GetInstance() \ + ->parameterized_test_registry() \ + .GetTestSuitePatternHolder( \ + GTEST_STRINGIFY_(test_suite_name), \ + ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ + ->AddTestSuiteInstantiation( \ + GTEST_STRINGIFY_(prefix), \ + >est_##prefix##test_suite_name##_EvalGenerator_, \ + >est_##prefix##test_suite_name##_EvalGenerateName_, \ __FILE__, __LINE__) - // Allow Marking a Parameterized test class as not needing to be instantiated. -#define GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(T) \ +#define GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(T) \ namespace gtest_do_not_use_outside_namespace_scope {} \ static const ::testing::internal::MarkAsIgnored gtest_allow_ignore_##T( \ GTEST_STRINGIFY_(T)) diff --git a/Testing/lib/googletest-master/googletest/include/gtest/gtest-printers.h b/Testing/lib/googletest-master/googletest/include/gtest/gtest-printers.h index f24512a9f..1ef3c2aa6 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/gtest-printers.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/gtest-printers.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Google Test - The Google C++ Testing and Mocking Framework // // This file implements a universal value printer that can print a @@ -108,6 +107,7 @@ #include #include #include + #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-port.h" @@ -267,12 +267,10 @@ struct ConvertibleToStringViewPrinter { #endif }; - // Prints the given number of bytes in the given object to the given // ostream. GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes, - size_t count, - ::std::ostream* os); + size_t count, ::std::ostream* os); struct FallbackPrinter { template static void PrintValue(const T& value, ::std::ostream* os) { @@ -375,12 +373,12 @@ GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char32_t); // to point to a NUL-terminated string, and thus can print it as a string. #define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \ - template <> \ - class FormatForComparison { \ - public: \ - static ::std::string Format(CharType* value) { \ - return ::testing::PrintToString(value); \ - } \ + template <> \ + class FormatForComparison { \ + public: \ + static ::std::string Format(CharType* value) { \ + return ::testing::PrintToString(value); \ + } \ } GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string); @@ -410,8 +408,8 @@ GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring); // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. template -std::string FormatForComparisonFailureMessage( - const T1& value, const T2& /* other_operand */) { +std::string FormatForComparisonFailureMessage(const T1& value, + const T2& /* other_operand */) { return FormatForComparison::Format(value); } @@ -548,14 +546,14 @@ void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) { } // Overloads for ::std::string. -GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os); +GTEST_API_ void PrintStringTo(const ::std::string& s, ::std::ostream* os); inline void PrintTo(const ::std::string& s, ::std::ostream* os) { PrintStringTo(s, os); } // Overloads for ::std::wstring. #if GTEST_HAS_STD_WSTRING -GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os); +GTEST_API_ void PrintWideStringTo(const ::std::wstring& s, ::std::ostream* os); inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) { PrintWideStringTo(s, os); } @@ -744,12 +742,12 @@ void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) { } } // This overload prints a (const) char array compactly. -GTEST_API_ void UniversalPrintArray( - const char* begin, size_t len, ::std::ostream* os); +GTEST_API_ void UniversalPrintArray(const char* begin, size_t len, + ::std::ostream* os); // This overload prints a (const) wchar_t array compactly. -GTEST_API_ void UniversalPrintArray( - const wchar_t* begin, size_t len, ::std::ostream* os); +GTEST_API_ void UniversalPrintArray(const wchar_t* begin, size_t len, + ::std::ostream* os); // Implements printing an array type T[N]. template @@ -865,10 +863,10 @@ void UniversalPrint(const T& value, ::std::ostream* os) { UniversalPrinter::Print(value, os); } -typedef ::std::vector< ::std::string> Strings; +typedef ::std::vector<::std::string> Strings; - // Tersely prints the first N fields of a tuple to a string vector, - // one element for each field. +// Tersely prints the first N fields of a tuple to a string vector, +// one element for each field. template void TersePrintPrefixToStrings(const Tuple&, std::integral_constant, Strings*) {} diff --git a/Testing/lib/googletest-master/googletest/include/gtest/gtest-spi.h b/Testing/lib/googletest-master/googletest/include/gtest/gtest-spi.h index aa38870e8..71318312d 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/gtest-spi.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/gtest-spi.h @@ -104,6 +104,7 @@ class GTEST_API_ SingleFailureChecker { SingleFailureChecker(const TestPartResultArray* results, TestPartResult::Type type, const std::string& substr); ~SingleFailureChecker(); + private: const TestPartResultArray* const results_; const TestPartResult::Type type_; @@ -141,38 +142,39 @@ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 // helper macro, due to some peculiarity in how the preprocessor // works. The AcceptsMacroThatExpandsToUnprotectedComma test in // gtest_unittest.cc will fail to compile if we do that. -#define EXPECT_FATAL_FAILURE(statement, substr) \ - do { \ - class GTestExpectFatalFailureHelper {\ - public:\ - static void Execute() { statement; }\ - };\ - ::testing::TestPartResultArray gtest_failures;\ - ::testing::internal::SingleFailureChecker gtest_checker(\ - >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ - {\ - ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ - ::testing::ScopedFakeTestPartResultReporter:: \ - INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ - GTestExpectFatalFailureHelper::Execute();\ - }\ +#define EXPECT_FATAL_FAILURE(statement, substr) \ + do { \ + class GTestExpectFatalFailureHelper { \ + public: \ + static void Execute() { statement; } \ + }; \ + ::testing::TestPartResultArray gtest_failures; \ + ::testing::internal::SingleFailureChecker gtest_checker( \ + >est_failures, ::testing::TestPartResult::kFatalFailure, (substr)); \ + { \ + ::testing::ScopedFakeTestPartResultReporter gtest_reporter( \ + ::testing::ScopedFakeTestPartResultReporter:: \ + INTERCEPT_ONLY_CURRENT_THREAD, \ + >est_failures); \ + GTestExpectFatalFailureHelper::Execute(); \ + } \ } while (::testing::internal::AlwaysFalse()) -#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ - do { \ - class GTestExpectFatalFailureHelper {\ - public:\ - static void Execute() { statement; }\ - };\ - ::testing::TestPartResultArray gtest_failures;\ - ::testing::internal::SingleFailureChecker gtest_checker(\ - >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ - {\ - ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ - ::testing::ScopedFakeTestPartResultReporter:: \ - INTERCEPT_ALL_THREADS, >est_failures);\ - GTestExpectFatalFailureHelper::Execute();\ - }\ +#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ + do { \ + class GTestExpectFatalFailureHelper { \ + public: \ + static void Execute() { statement; } \ + }; \ + ::testing::TestPartResultArray gtest_failures; \ + ::testing::internal::SingleFailureChecker gtest_checker( \ + >est_failures, ::testing::TestPartResult::kFatalFailure, (substr)); \ + { \ + ::testing::ScopedFakeTestPartResultReporter gtest_reporter( \ + ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \ + >est_failures); \ + GTestExpectFatalFailureHelper::Execute(); \ + } \ } while (::testing::internal::AlwaysFalse()) // A macro for testing Google Test assertions or code that's expected to @@ -207,32 +209,37 @@ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 // instead of // GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) // to avoid an MSVC warning on unreachable code. -#define EXPECT_NONFATAL_FAILURE(statement, substr) \ - do {\ - ::testing::TestPartResultArray gtest_failures;\ - ::testing::internal::SingleFailureChecker gtest_checker(\ +#define EXPECT_NONFATAL_FAILURE(statement, substr) \ + do { \ + ::testing::TestPartResultArray gtest_failures; \ + ::testing::internal::SingleFailureChecker gtest_checker( \ >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ - (substr));\ - {\ - ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ - ::testing::ScopedFakeTestPartResultReporter:: \ - INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ - if (::testing::internal::AlwaysTrue()) { statement; }\ - }\ + (substr)); \ + { \ + ::testing::ScopedFakeTestPartResultReporter gtest_reporter( \ + ::testing::ScopedFakeTestPartResultReporter:: \ + INTERCEPT_ONLY_CURRENT_THREAD, \ + >est_failures); \ + if (::testing::internal::AlwaysTrue()) { \ + statement; \ + } \ + } \ } while (::testing::internal::AlwaysFalse()) -#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ - do {\ - ::testing::TestPartResultArray gtest_failures;\ - ::testing::internal::SingleFailureChecker gtest_checker(\ - >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ - (substr));\ - {\ - ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ +#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ + do { \ + ::testing::TestPartResultArray gtest_failures; \ + ::testing::internal::SingleFailureChecker gtest_checker( \ + >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ + (substr)); \ + { \ + ::testing::ScopedFakeTestPartResultReporter gtest_reporter( \ ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \ - >est_failures);\ - if (::testing::internal::AlwaysTrue()) { statement; }\ - }\ + >est_failures); \ + if (::testing::internal::AlwaysTrue()) { \ + statement; \ + } \ + } \ } while (::testing::internal::AlwaysFalse()) #endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_ diff --git a/Testing/lib/googletest-master/googletest/include/gtest/gtest-test-part.h b/Testing/lib/googletest-master/googletest/include/gtest/gtest-test-part.h index 05a798535..b405d7b7b 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/gtest-test-part.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/gtest-test-part.h @@ -34,6 +34,7 @@ #include #include + #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-string.h" @@ -168,6 +169,7 @@ class GTEST_API_ HasNewFatalFailureHelper ~HasNewFatalFailureHelper() override; void ReportTestPartResult(const TestPartResult& result) override; bool has_new_fatal_failure() const { return has_new_fatal_failure_; } + private: bool has_new_fatal_failure_; TestPartResultReporterInterface* original_reporter_; diff --git a/Testing/lib/googletest-master/googletest/include/gtest/gtest-typed-test.h b/Testing/lib/googletest-master/googletest/include/gtest/gtest-typed-test.h index 3ffa50b73..230cc1111 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/gtest-typed-test.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/gtest-typed-test.h @@ -192,7 +192,7 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); typedef ::testing::internal::GenerateTypeList::type \ GTEST_TYPE_PARAMS_(CaseName); \ typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \ - GTEST_NAME_GENERATOR_(CaseName) + GTEST_NAME_GENERATOR_(CaseName) #define TYPED_TEST(CaseName, TestName) \ static_assert(sizeof(GTEST_STRINGIFY_(TestName)) > 1, \ @@ -262,7 +262,7 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); // #included in multiple translation units linked together. #define TYPED_TEST_SUITE_P(SuiteName) \ static ::testing::internal::TypedTestSuitePState \ - GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName) + GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName) // Legacy API is deprecated but still available #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ @@ -271,28 +271,28 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); TYPED_TEST_SUITE_P #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -#define TYPED_TEST_P(SuiteName, TestName) \ - namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \ - template \ - class TestName : public SuiteName { \ - private: \ - typedef SuiteName TestFixture; \ - typedef gtest_TypeParam_ TypeParam; \ - void TestBody() override; \ - }; \ - static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \ - GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \ - __FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \ - GTEST_STRINGIFY_(TestName)); \ - } \ - template \ - void GTEST_SUITE_NAMESPACE_( \ +#define TYPED_TEST_P(SuiteName, TestName) \ + namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \ + template \ + class TestName : public SuiteName { \ + private: \ + typedef SuiteName TestFixture; \ + typedef gtest_TypeParam_ TypeParam; \ + void TestBody() override; \ + }; \ + static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \ + GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \ + __FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \ + GTEST_STRINGIFY_(TestName)); \ + } \ + template \ + void GTEST_SUITE_NAMESPACE_( \ SuiteName)::TestName::TestBody() // Note: this won't work correctly if the trailing arguments are macros. #define REGISTER_TYPED_TEST_SUITE_P(SuiteName, ...) \ namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \ - typedef ::testing::internal::Templates<__VA_ARGS__> gtest_AllTests_; \ + typedef ::testing::internal::Templates<__VA_ARGS__> gtest_AllTests_; \ } \ static const char* const GTEST_REGISTERED_TEST_NAMES_( \ SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \ @@ -307,21 +307,21 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); REGISTER_TYPED_TEST_SUITE_P #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -#define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \ - static_assert(sizeof(GTEST_STRINGIFY_(Prefix)) > 1, \ - "test-suit-prefix must not be empty"); \ - static bool gtest_##Prefix##_##SuiteName GTEST_ATTRIBUTE_UNUSED_ = \ - ::testing::internal::TypeParameterizedTestSuite< \ - SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \ - ::testing::internal::GenerateTypeList::type>:: \ - Register(GTEST_STRINGIFY_(Prefix), \ - ::testing::internal::CodeLocation(__FILE__, __LINE__), \ - >EST_TYPED_TEST_SUITE_P_STATE_(SuiteName), \ - GTEST_STRINGIFY_(SuiteName), \ - GTEST_REGISTERED_TEST_NAMES_(SuiteName), \ - ::testing::internal::GenerateNames< \ - ::testing::internal::NameGeneratorSelector< \ - __VA_ARGS__>::type, \ +#define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \ + static_assert(sizeof(GTEST_STRINGIFY_(Prefix)) > 1, \ + "test-suit-prefix must not be empty"); \ + static bool gtest_##Prefix##_##SuiteName GTEST_ATTRIBUTE_UNUSED_ = \ + ::testing::internal::TypeParameterizedTestSuite< \ + SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \ + ::testing::internal::GenerateTypeList::type>:: \ + Register(GTEST_STRINGIFY_(Prefix), \ + ::testing::internal::CodeLocation(__FILE__, __LINE__), \ + >EST_TYPED_TEST_SUITE_P_STATE_(SuiteName), \ + GTEST_STRINGIFY_(SuiteName), \ + GTEST_REGISTERED_TEST_NAMES_(SuiteName), \ + ::testing::internal::GenerateNames< \ + ::testing::internal::NameGeneratorSelector< \ + __VA_ARGS__>::type, \ ::testing::internal::GenerateTypeList::type>()) // Legacy API is deprecated but still available diff --git a/Testing/lib/googletest-master/googletest/include/gtest/gtest.h b/Testing/lib/googletest-master/googletest/include/gtest/gtest.h index 75ccc8bce..a54efb50e 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/gtest.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/gtest.h @@ -59,16 +59,16 @@ #include #include -#include "gtest/internal/gtest-internal.h" -#include "gtest/internal/gtest-string.h" #include "gtest/gtest-death-test.h" #include "gtest/gtest-matchers.h" #include "gtest/gtest-message.h" #include "gtest/gtest-param-test.h" #include "gtest/gtest-printers.h" -#include "gtest/gtest_prod.h" #include "gtest/gtest-test-part.h" #include "gtest/gtest-typed-test.h" +#include "gtest/gtest_prod.h" +#include "gtest/internal/gtest-internal.h" +#include "gtest/internal/gtest-string.h" GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) @@ -78,12 +78,11 @@ namespace testing { // Silence C4100 (unreferenced formal parameter) and 4805 // unsafe mix of type 'const int' and type 'const bool' #ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4805) -# pragma warning(disable:4100) +#pragma warning(push) +#pragma warning(disable : 4805) +#pragma warning(disable : 4100) #endif - // Declares the flags. // This flag temporary enables the disabled tests. @@ -337,7 +336,8 @@ class GTEST_API_ AssertionResult { const char* failure_message() const { return message(); } // Streams a custom failure message into this object. - template AssertionResult& operator<<(const T& value) { + template + AssertionResult& operator<<(const T& value) { AppendMessage(Message() << value); return *this; } @@ -535,24 +535,17 @@ class TestProperty { // C'tor. TestProperty does NOT have a default constructor. // Always use this constructor (with parameters) to create a // TestProperty object. - TestProperty(const std::string& a_key, const std::string& a_value) : - key_(a_key), value_(a_value) { - } + TestProperty(const std::string& a_key, const std::string& a_value) + : key_(a_key), value_(a_value) {} // Gets the user supplied key. - const char* key() const { - return key_.c_str(); - } + const char* key() const { return key_.c_str(); } // Gets the user supplied value. - const char* value() const { - return value_.c_str(); - } + const char* value() const { return value_.c_str(); } // Sets a new value, overriding the one supplied in the constructor. - void SetValue(const std::string& new_value) { - value_ = new_value; - } + void SetValue(const std::string& new_value) { value_ = new_value; } private: // The key supplied by the user. @@ -810,8 +803,8 @@ class GTEST_API_ TestInfo { } // These fields are immutable properties of the test. - const std::string test_suite_name_; // test suite name - const std::string name_; // Test name + const std::string test_suite_name_; // test suite name + const std::string name_; // Test name // Name of the parameter type, or NULL if this is not a typed or a // type-parameterized test. const std::unique_ptr type_param_; @@ -940,7 +933,7 @@ class GTEST_API_ TestSuite { // Adds a TestInfo to this test suite. Will delete the TestInfo upon // destruction of the TestSuite object. - void AddTestInfo(TestInfo * test_info); + void AddTestInfo(TestInfo* test_info); // Clears the results of all tests in this test suite. void ClearResult(); @@ -1068,6 +1061,7 @@ class Environment { // Override this to define how to tear down the environment. virtual void TearDown() {} + private: // If you see an error about overriding the following function or // about it being private, you have mis-spelled SetUp() as Setup(). @@ -1120,8 +1114,9 @@ class TestEventListener { virtual void OnTestStart(const TestInfo& test_info) = 0; // Fired after a failed assertion or a SUCCEED() invocation. - // If you want to throw an exception from this function to skip to the nextNode - // TEST, it must be AssertionException defined above, or inherited from it. + // If you want to throw an exception from this function to skip to the + // nextNode TEST, it must be AssertionException defined above, or inherited + // from it. virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0; // Fired after the test ends. @@ -1142,8 +1137,7 @@ class TestEventListener { virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0; // Fired after each iteration of tests finishes. - virtual void OnTestIterationEnd(const UnitTest& unit_test, - int iteration) = 0; + virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration) = 0; // Fired after all test activities have ended. virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0; @@ -1300,8 +1294,7 @@ class GTEST_API_ UnitTest { // Returns the TestInfo object for the test that's currently running, // or NULL if no test is running. - const TestInfo* current_test_info() const - GTEST_LOCK_EXCLUDED_(mutex_); + const TestInfo* current_test_info() const GTEST_LOCK_EXCLUDED_(mutex_); // Returns the random seed used at the start of the current test run. int random_seed() const; @@ -1407,8 +1400,7 @@ class GTEST_API_ UnitTest { // eventually call this to report their results. The user code // should use the assertion macros instead of calling this directly. void AddTestPartResult(TestPartResult::Type result_type, - const char* file_name, - int line_number, + const char* file_name, int line_number, const std::string& message, const std::string& os_stack_trace) GTEST_LOCK_EXCLUDED_(mutex_); @@ -1439,8 +1431,7 @@ class GTEST_API_ UnitTest { friend std::set* internal::GetIgnoredParameterizedTestSuites(); friend internal::UnitTestImpl* internal::GetUnitTestImpl(); friend void internal::ReportFailureInUnknownLocation( - TestPartResult::Type result_type, - const std::string& message); + TestPartResult::Type result_type, const std::string& message); // Creates an empty UnitTest. UnitTest(); @@ -1454,8 +1445,7 @@ class GTEST_API_ UnitTest { GTEST_LOCK_EXCLUDED_(mutex_); // Pops a trace from the per-thread Google Test trace stack. - void PopGTestTrace() - GTEST_LOCK_EXCLUDED_(mutex_); + void PopGTestTrace() GTEST_LOCK_EXCLUDED_(mutex_); // Protects mutable state in *impl_. This is mutable as some const // methods need to lock it too. @@ -1519,13 +1509,11 @@ namespace internal { // when calling EXPECT_* in a tight loop. template AssertionResult CmpHelperEQFailure(const char* lhs_expression, - const char* rhs_expression, - const T1& lhs, const T2& rhs) { - return EqFailure(lhs_expression, - rhs_expression, + const char* rhs_expression, const T1& lhs, + const T2& rhs) { + return EqFailure(lhs_expression, rhs_expression, FormatForComparisonFailureMessage(lhs, rhs), - FormatForComparisonFailureMessage(rhs, lhs), - false); + FormatForComparisonFailureMessage(rhs, lhs), false); } // This block of code defines operator==/!= @@ -1538,8 +1526,7 @@ inline bool operator!=(faketype, faketype) { return false; } // The helper function for {ASSERT|EXPECT}_EQ. template AssertionResult CmpHelperEQ(const char* lhs_expression, - const char* rhs_expression, - const T1& lhs, + const char* rhs_expression, const T1& lhs, const T2& rhs) { if (lhs == rhs) { return AssertionSuccess(); @@ -1553,8 +1540,7 @@ AssertionResult CmpHelperEQ(const char* lhs_expression, // can be implicitly cast to BiggestInt. GTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression, const char* rhs_expression, - BiggestInt lhs, - BiggestInt rhs); + BiggestInt lhs, BiggestInt rhs); class EqHelper { public: @@ -1578,8 +1564,7 @@ class EqHelper { // Even though its body looks the same as the above version, we // cannot merge the two, as it will make anonymous enums unhappy. static AssertionResult Compare(const char* lhs_expression, - const char* rhs_expression, - BiggestInt lhs, + const char* rhs_expression, BiggestInt lhs, BiggestInt rhs) { return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); } @@ -1619,18 +1604,18 @@ AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2, // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -#define GTEST_IMPL_CMP_HELPER_(op_name, op)\ -template \ -AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \ - const T1& val1, const T2& val2) {\ - if (val1 op val2) {\ - return AssertionSuccess();\ - } else {\ - return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\ - }\ -}\ -GTEST_API_ AssertionResult CmpHelper##op_name(\ - const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2) +#define GTEST_IMPL_CMP_HELPER_(op_name, op) \ + template \ + AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \ + const T1& val1, const T2& val2) { \ + if (val1 op val2) { \ + return AssertionSuccess(); \ + } else { \ + return CmpHelperOpFailure(expr1, expr2, val1, val2, #op); \ + } \ + } \ + GTEST_API_ AssertionResult CmpHelper##op_name( \ + const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2) // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. @@ -1652,49 +1637,42 @@ GTEST_IMPL_CMP_HELPER_(GT, >); // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression, const char* s2_expression, - const char* s1, - const char* s2); + const char* s1, const char* s2); // The helper function for {ASSERT|EXPECT}_STRCASEEQ. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression, const char* s2_expression, - const char* s1, - const char* s2); + const char* s1, const char* s2); // The helper function for {ASSERT|EXPECT}_STRNE. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression, const char* s2_expression, - const char* s1, - const char* s2); + const char* s1, const char* s2); // The helper function for {ASSERT|EXPECT}_STRCASENE. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression, const char* s2_expression, - const char* s1, - const char* s2); - + const char* s1, const char* s2); // Helper function for *_STREQ on wide strings. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression, const char* s2_expression, - const wchar_t* s1, - const wchar_t* s2); + const wchar_t* s1, const wchar_t* s2); // Helper function for *_STRNE on wide strings. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression, const char* s2_expression, - const wchar_t* s1, - const wchar_t* s2); + const wchar_t* s1, const wchar_t* s2); } // namespace internal @@ -1706,32 +1684,40 @@ GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression, // // The {needle,haystack}_expr arguments are the stringified // expressions that generated the two real arguments. -GTEST_API_ AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const char* needle, const char* haystack); -GTEST_API_ AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const wchar_t* needle, const wchar_t* haystack); -GTEST_API_ AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const char* needle, const char* haystack); -GTEST_API_ AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const wchar_t* needle, const wchar_t* haystack); -GTEST_API_ AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::string& needle, const ::std::string& haystack); -GTEST_API_ AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::string& needle, const ::std::string& haystack); +GTEST_API_ AssertionResult IsSubstring(const char* needle_expr, + const char* haystack_expr, + const char* needle, + const char* haystack); +GTEST_API_ AssertionResult IsSubstring(const char* needle_expr, + const char* haystack_expr, + const wchar_t* needle, + const wchar_t* haystack); +GTEST_API_ AssertionResult IsNotSubstring(const char* needle_expr, + const char* haystack_expr, + const char* needle, + const char* haystack); +GTEST_API_ AssertionResult IsNotSubstring(const char* needle_expr, + const char* haystack_expr, + const wchar_t* needle, + const wchar_t* haystack); +GTEST_API_ AssertionResult IsSubstring(const char* needle_expr, + const char* haystack_expr, + const ::std::string& needle, + const ::std::string& haystack); +GTEST_API_ AssertionResult IsNotSubstring(const char* needle_expr, + const char* haystack_expr, + const ::std::string& needle, + const ::std::string& haystack); #if GTEST_HAS_STD_WSTRING -GTEST_API_ AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::wstring& needle, const ::std::wstring& haystack); -GTEST_API_ AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::wstring& needle, const ::std::wstring& haystack); +GTEST_API_ AssertionResult IsSubstring(const char* needle_expr, + const char* haystack_expr, + const ::std::wstring& needle, + const ::std::wstring& haystack); +GTEST_API_ AssertionResult IsNotSubstring(const char* needle_expr, + const char* haystack_expr, + const ::std::wstring& needle, + const ::std::wstring& haystack); #endif // GTEST_HAS_STD_WSTRING namespace internal { @@ -1746,8 +1732,7 @@ namespace internal { template AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression, const char* rhs_expression, - RawType lhs_value, - RawType rhs_value) { + RawType lhs_value, RawType rhs_value) { const FloatingPoint lhs(lhs_value), rhs(rhs_value); if (lhs.AlmostEquals(rhs)) { @@ -1762,10 +1747,8 @@ AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression, rhs_ss << std::setprecision(std::numeric_limits::digits10 + 2) << rhs_value; - return EqFailure(lhs_expression, - rhs_expression, - StringStreamToString(&lhs_ss), - StringStreamToString(&rhs_ss), + return EqFailure(lhs_expression, rhs_expression, + StringStreamToString(&lhs_ss), StringStreamToString(&rhs_ss), false); } @@ -1775,8 +1758,7 @@ AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression, GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1, const char* expr2, const char* abs_error_expr, - double val1, - double val2, + double val1, double val2, double abs_error); // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. @@ -1784,9 +1766,7 @@ GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1, class GTEST_API_ AssertHelper { public: // Constructor. - AssertHelper(TestPartResult::Type type, - const char* file, - int line, + AssertHelper(TestPartResult::Type type, const char* file, int line, const char* message); ~AssertHelper(); @@ -1800,11 +1780,9 @@ class GTEST_API_ AssertHelper { // re-using stack space even for temporary variables, so every EXPECT_EQ // reserves stack space for another AssertHelper. struct AssertHelperData { - AssertHelperData(TestPartResult::Type t, - const char* srcfile, - int line_num, + AssertHelperData(TestPartResult::Type t, const char* srcfile, int line_num, const char* msg) - : type(t), file(srcfile), line(line_num), message(msg) { } + : type(t), file(srcfile), line(line_num), message(msg) {} TestPartResult::Type const type; const char* const file; @@ -1874,15 +1852,14 @@ class WithParamInterface { private: // Sets parameter value. The caller is responsible for making sure the value // remains alive and unchanged throughout the current test. - static void SetParam(const ParamType* parameter) { - parameter_ = parameter; - } + static void SetParam(const ParamType* parameter) { parameter_ = parameter; } // Static value used for accessing parameter during a test lifetime. static const ParamType* parameter_; // TestClass must be a subclass of WithParamInterface and Test. - template friend class internal::ParameterizedTestFactory; + template + friend class internal::ParameterizedTestFactory; }; template @@ -1892,8 +1869,7 @@ const T* WithParamInterface::parameter_ = nullptr; // WithParamInterface, and can just inherit from ::testing::TestWithParam. template -class TestWithParam : public Test, public WithParamInterface { -}; +class TestWithParam : public Test, public WithParamInterface {}; // Macros for indicating success/failure in test code. @@ -1924,7 +1900,7 @@ class TestWithParam : public Test, public WithParamInterface { // Generates a nonfatal failure at the given source file location with // a generic message. -#define ADD_FAILURE_AT(file, line) \ +#define ADD_FAILURE_AT(file, line) \ GTEST_MESSAGE_AT_(file, line, "Failed", \ ::testing::TestPartResult::kNonFatalFailure) @@ -1939,7 +1915,7 @@ class TestWithParam : public Test, public WithParamInterface { // Define this macro to 1 to omit the definition of FAIL(), which is a // generic name and clashes with some other libraries. #if !GTEST_DONT_DEFINE_FAIL -# define FAIL() GTEST_FAIL() +#define FAIL() GTEST_FAIL() #endif // Generates a success with a generic message. @@ -1948,7 +1924,7 @@ class TestWithParam : public Test, public WithParamInterface { // Define this macro to 1 to omit the definition of SUCCEED(), which // is a generic name and clashes with some other libraries. #if !GTEST_DONT_DEFINE_SUCCEED -# define SUCCEED() GTEST_SUCCEED() +#define SUCCEED() GTEST_SUCCEED() #endif // Macros for testing exceptions. @@ -1976,16 +1952,15 @@ class TestWithParam : public Test, public WithParamInterface { // Boolean assertions. Condition can be either a Boolean expression or an // AssertionResult. For more information on how to use AssertionResult with // these macros see comments on that class. -#define EXPECT_TRUE(condition) \ +#define EXPECT_TRUE(condition) \ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \ GTEST_NONFATAL_FAILURE_) -#define EXPECT_FALSE(condition) \ +#define EXPECT_FALSE(condition) \ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ GTEST_NONFATAL_FAILURE_) #define ASSERT_TRUE(condition) \ - GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \ - GTEST_FATAL_FAILURE_) -#define ASSERT_FALSE(condition) \ + GTEST_TEST_BOOLEAN_(condition, #condition, false, true, GTEST_FATAL_FAILURE_) +#define ASSERT_FALSE(condition) \ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ GTEST_FATAL_FAILURE_) @@ -2065,27 +2040,27 @@ class TestWithParam : public Test, public WithParamInterface { // ASSERT_XY(), which clashes with some users' own code. #if !GTEST_DONT_DEFINE_ASSERT_EQ -# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2) +#define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_NE -# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2) +#define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_LE -# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2) +#define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_LT -# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2) +#define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_GE -# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2) +#define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_GT -# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2) +#define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2) #endif // C-string Comparisons. All tests treat NULL and any non-NULL string @@ -2110,7 +2085,7 @@ class TestWithParam : public Test, public WithParamInterface { EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2) #define EXPECT_STRCASEEQ(s1, s2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2) -#define EXPECT_STRCASENE(s1, s2)\ +#define EXPECT_STRCASENE(s1, s2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2) #define ASSERT_STREQ(s1, s2) \ @@ -2119,7 +2094,7 @@ class TestWithParam : public Test, public WithParamInterface { ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2) #define ASSERT_STRCASEEQ(s1, s2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2) -#define ASSERT_STRCASENE(s1, s2)\ +#define ASSERT_STRCASENE(s1, s2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2) // Macros for comparing floating-point numbers. @@ -2136,29 +2111,29 @@ class TestWithParam : public Test, public WithParamInterface { // FloatingPoint template class in gtest-internal.h if you are // interested in the implementation details. -#define EXPECT_FLOAT_EQ(val1, val2)\ +#define EXPECT_FLOAT_EQ(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ, \ val1, val2) -#define EXPECT_DOUBLE_EQ(val1, val2)\ +#define EXPECT_DOUBLE_EQ(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ, \ val1, val2) -#define ASSERT_FLOAT_EQ(val1, val2)\ +#define ASSERT_FLOAT_EQ(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ, \ val1, val2) -#define ASSERT_DOUBLE_EQ(val1, val2)\ +#define ASSERT_DOUBLE_EQ(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ, \ val1, val2) -#define EXPECT_NEAR(val1, val2, abs_error)\ - EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \ - val1, val2, abs_error) +#define EXPECT_NEAR(val1, val2, abs_error) \ + EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, val1, val2, \ + abs_error) -#define ASSERT_NEAR(val1, val2, abs_error)\ - ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \ - val1, val2, abs_error) +#define ASSERT_NEAR(val1, val2, abs_error) \ + ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, val1, val2, \ + abs_error) // These predicate format functions work on floating-point values, and // can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g. @@ -2172,7 +2147,6 @@ GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2, GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2, double val1, double val2); - #if GTEST_OS_WINDOWS // Macros that test for HRESULT failure and success, these are only useful @@ -2184,17 +2158,17 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2, // expected result and the actual result with both a human-readable // string representation of the error, if available, as well as the // hex result code. -# define EXPECT_HRESULT_SUCCEEDED(expr) \ - EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr)) +#define EXPECT_HRESULT_SUCCEEDED(expr) \ + EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr)) -# define ASSERT_HRESULT_SUCCEEDED(expr) \ - ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr)) +#define ASSERT_HRESULT_SUCCEEDED(expr) \ + ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr)) -# define EXPECT_HRESULT_FAILED(expr) \ - EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr)) +#define EXPECT_HRESULT_FAILED(expr) \ + EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr)) -# define ASSERT_HRESULT_FAILED(expr) \ - ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr)) +#define ASSERT_HRESULT_FAILED(expr) \ + ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr)) #endif // GTEST_OS_WINDOWS @@ -2209,9 +2183,9 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2, // ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed"; // #define ASSERT_NO_FATAL_FAILURE(statement) \ - GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_) + GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_) #define EXPECT_NO_FATAL_FAILURE(statement) \ - GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_) + GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_) // Causes a trace (including the given source file path and line number, // and the given message) to be included in every test failure message generated @@ -2273,9 +2247,9 @@ class GTEST_API_ ScopedTrace { // Assuming that each thread maintains its own stack of traces. // Therefore, a SCOPED_TRACE() would (correctly) only affect the // assertions in its own thread. -#define SCOPED_TRACE(message) \ - ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\ - __FILE__, __LINE__, (message)) +#define SCOPED_TRACE(message) \ + ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)( \ + __FILE__, __LINE__, (message)) // Compile-time assertion for type equality. // StaticAssertTypeEq() compiles if and only if type1 and type2 @@ -2376,7 +2350,7 @@ constexpr bool StaticAssertTypeEq() noexcept { // // GOOGLETEST_CM0011 DO NOT DELETE #if !GTEST_DONT_DEFINE_TEST -#define TEST_F(test_fixture, test_name)\ +#define TEST_F(test_fixture, test_name) \ GTEST_TEST_(test_fixture, test_name, test_fixture, \ ::testing::internal::GetTypeId()) #endif // !GTEST_DONT_DEFINE_TEST @@ -2386,7 +2360,7 @@ constexpr bool StaticAssertTypeEq() noexcept { GTEST_API_ std::string TempDir(); #ifdef _MSC_VER -# pragma warning(pop) +#pragma warning(pop) #endif // Dynamically registers a test with the framework. @@ -2481,9 +2455,7 @@ TestInfo* RegisterTest(const char* test_suite_name, const char* test_name, // namespace and has an all-caps name. int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_; -inline int RUN_ALL_TESTS() { - return ::testing::UnitTest::GetInstance()->Run(); -} +inline int RUN_ALL_TESTS() { return ::testing::UnitTest::GetInstance()->Run(); } GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 diff --git a/Testing/lib/googletest-master/googletest/include/gtest/gtest_pred_impl.h b/Testing/lib/googletest-master/googletest/include/gtest/gtest_pred_impl.h index d514255c7..96a57b21a 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/gtest_pred_impl.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/gtest_pred_impl.h @@ -72,22 +72,18 @@ namespace testing { // GTEST_ASSERT_ is the basic statement to which all of the assertions // in this file reduce. Don't use this in your code. -#define GTEST_ASSERT_(expression, on_failure) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ +#define GTEST_ASSERT_(expression, on_failure) \ + GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (const ::testing::AssertionResult gtest_ar = (expression)) \ - ; \ - else \ + ; \ + else \ on_failure(gtest_ar.failure_message()) - // Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use // this in your code. -template -AssertionResult AssertPred1Helper(const char* pred_text, - const char* e1, - Pred pred, - const T1& v1) { +template +AssertionResult AssertPred1Helper(const char* pred_text, const char* e1, + Pred pred, const T1& v1) { if (pred(v1)) return AssertionSuccess(); return AssertionFailure() @@ -98,40 +94,27 @@ AssertionResult AssertPred1Helper(const char* pred_text, // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1. // Don't use this in your code. -#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\ - GTEST_ASSERT_(pred_format(#v1, v1), \ - on_failure) +#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure) \ + GTEST_ASSERT_(pred_format(#v1, v1), on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use // this in your code. -#define GTEST_PRED1_(pred, v1, on_failure)\ - GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \ - #v1, \ - pred, \ - v1), on_failure) +#define GTEST_PRED1_(pred, v1, on_failure) \ + GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, #v1, pred, v1), on_failure) // Unary predicate assertion macros. #define EXPECT_PRED_FORMAT1(pred_format, v1) \ GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_) -#define EXPECT_PRED1(pred, v1) \ - GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_) +#define EXPECT_PRED1(pred, v1) GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_) #define ASSERT_PRED_FORMAT1(pred_format, v1) \ GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_) -#define ASSERT_PRED1(pred, v1) \ - GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_) - - +#define ASSERT_PRED1(pred, v1) GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_) // Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use // this in your code. -template -AssertionResult AssertPred2Helper(const char* pred_text, - const char* e1, - const char* e2, - Pred pred, - const T1& v1, +template +AssertionResult AssertPred2Helper(const char* pred_text, const char* e1, + const char* e2, Pred pred, const T1& v1, const T2& v2) { if (pred(v1, v2)) return AssertionSuccess(); @@ -145,19 +128,14 @@ AssertionResult AssertPred2Helper(const char* pred_text, // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2. // Don't use this in your code. -#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\ - GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \ - on_failure) +#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure) \ + GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use // this in your code. -#define GTEST_PRED2_(pred, v1, v2, on_failure)\ - GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \ - #v1, \ - #v2, \ - pred, \ - v1, \ - v2), on_failure) +#define GTEST_PRED2_(pred, v1, v2, on_failure) \ + GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, #v1, #v2, pred, v1, v2), \ + on_failure) // Binary predicate assertion macros. #define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \ @@ -169,22 +147,12 @@ AssertionResult AssertPred2Helper(const char* pred_text, #define ASSERT_PRED2(pred, v1, v2) \ GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_) - - // Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use // this in your code. -template -AssertionResult AssertPred3Helper(const char* pred_text, - const char* e1, - const char* e2, - const char* e3, - Pred pred, - const T1& v1, - const T2& v2, - const T3& v3) { +template +AssertionResult AssertPred3Helper(const char* pred_text, const char* e1, + const char* e2, const char* e3, Pred pred, + const T1& v1, const T2& v2, const T3& v3) { if (pred(v1, v2, v3)) return AssertionSuccess(); return AssertionFailure() @@ -198,21 +166,15 @@ AssertionResult AssertPred3Helper(const char* pred_text, // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3. // Don't use this in your code. -#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\ - GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \ - on_failure) +#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure) \ + GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use // this in your code. -#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\ - GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \ - #v1, \ - #v2, \ - #v3, \ - pred, \ - v1, \ - v2, \ - v3), on_failure) +#define GTEST_PRED3_(pred, v1, v2, v3, on_failure) \ + GTEST_ASSERT_( \ + ::testing::AssertPred3Helper(#pred, #v1, #v2, #v3, pred, v1, v2, v3), \ + on_failure) // Ternary predicate assertion macros. #define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \ @@ -224,25 +186,13 @@ AssertionResult AssertPred3Helper(const char* pred_text, #define ASSERT_PRED3(pred, v1, v2, v3) \ GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_) - - // Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use // this in your code. -template -AssertionResult AssertPred4Helper(const char* pred_text, - const char* e1, - const char* e2, - const char* e3, - const char* e4, - Pred pred, - const T1& v1, - const T2& v2, - const T3& v3, - const T4& v4) { +template +AssertionResult AssertPred4Helper(const char* pred_text, const char* e1, + const char* e2, const char* e3, + const char* e4, Pred pred, const T1& v1, + const T2& v2, const T3& v3, const T4& v4) { if (pred(v1, v2, v3, v4)) return AssertionSuccess(); return AssertionFailure() @@ -257,23 +207,15 @@ AssertionResult AssertPred4Helper(const char* pred_text, // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4. // Don't use this in your code. -#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\ - GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \ - on_failure) +#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure) \ + GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use // this in your code. -#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\ - GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \ - #v1, \ - #v2, \ - #v3, \ - #v4, \ - pred, \ - v1, \ - v2, \ - v3, \ - v4), on_failure) +#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure) \ + GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, #v1, #v2, #v3, #v4, pred, \ + v1, v2, v3, v4), \ + on_failure) // 4-ary predicate assertion macros. #define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \ @@ -285,28 +227,15 @@ AssertionResult AssertPred4Helper(const char* pred_text, #define ASSERT_PRED4(pred, v1, v2, v3, v4) \ GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_) - - // Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use // this in your code. -template -AssertionResult AssertPred5Helper(const char* pred_text, - const char* e1, - const char* e2, - const char* e3, - const char* e4, - const char* e5, - Pred pred, - const T1& v1, - const T2& v2, - const T3& v3, - const T4& v4, - const T5& v5) { +AssertionResult AssertPred5Helper(const char* pred_text, const char* e1, + const char* e2, const char* e3, + const char* e4, const char* e5, Pred pred, + const T1& v1, const T2& v2, const T3& v3, + const T4& v4, const T5& v5) { if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess(); return AssertionFailure() @@ -322,25 +251,16 @@ AssertionResult AssertPred5Helper(const char* pred_text, // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5. // Don't use this in your code. -#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\ +#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure) \ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \ on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use // this in your code. -#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\ - GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \ - #v1, \ - #v2, \ - #v3, \ - #v4, \ - #v5, \ - pred, \ - v1, \ - v2, \ - v3, \ - v4, \ - v5), on_failure) +#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure) \ + GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, #v1, #v2, #v3, #v4, #v5, \ + pred, v1, v2, v3, v4, v5), \ + on_failure) // 5-ary predicate assertion macros. #define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \ @@ -352,8 +272,6 @@ AssertionResult AssertPred5Helper(const char* pred_text, #define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \ GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_) - - } // namespace testing #endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ diff --git a/Testing/lib/googletest-master/googletest/include/gtest/gtest_prod.h b/Testing/lib/googletest-master/googletest/include/gtest/gtest_prod.h index e651671eb..3dc5b2386 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/gtest_prod.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/gtest_prod.h @@ -28,8 +28,8 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Google C++ Testing and Mocking Framework definitions useful in production code. -// GOOGLETEST_CM0003 DO NOT DELETE +// Google C++ Testing and Mocking Framework definitions useful in production +// code. GOOGLETEST_CM0003 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ @@ -55,7 +55,7 @@ // Note: The test class must be in the same namespace as the class being tested. // For example, putting MyClassTest in an anonymous namespace will not work. -#define FRIEND_TEST(test_case_name, test_name)\ -friend class test_case_name##_##test_name##_Test +#define FRIEND_TEST(test_case_name, test_name) \ + friend class test_case_name##_##test_name##_Test #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ diff --git a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-death-test-internal.h b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-death-test-internal.h index 68bd35306..e2f21437d 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-death-test-internal.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-death-test-internal.h @@ -36,12 +36,13 @@ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ -#include "gtest/gtest-matchers.h" -#include "gtest/internal/gtest-internal.h" - #include + #include +#include "gtest/gtest-matchers.h" +#include "gtest/internal/gtest-internal.h" + namespace testing { namespace internal { @@ -83,13 +84,14 @@ class GTEST_API_ DeathTest { static bool Create(const char* statement, Matcher matcher, const char* file, int line, DeathTest** test); DeathTest(); - virtual ~DeathTest() { } + virtual ~DeathTest() {} // A helper class that aborts a death test when it's deleted. class ReturnSentinel { public: - explicit ReturnSentinel(DeathTest* test) : test_(test) { } + explicit ReturnSentinel(DeathTest* test) : test_(test) {} ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); } + private: DeathTest* const test_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel); @@ -145,7 +147,7 @@ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 // Factory interface for death tests. May be mocked out for testing. class DeathTestFactory { public: - virtual ~DeathTestFactory() { } + virtual ~DeathTestFactory() {} virtual bool Create(const char* statement, Matcher matcher, const char* file, int line, DeathTest** test) = 0; @@ -186,28 +188,28 @@ inline Matcher MakeDeathTestMatcher( // Traps C++ exceptions escaping statement and reports them as test // failures. Note that trapping SEH exceptions is not implemented here. -# if GTEST_HAS_EXCEPTIONS -# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ - try { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } catch (const ::std::exception& gtest_exception) { \ - fprintf(\ - stderr, \ - "\n%s: Caught std::exception-derived exception escaping the " \ - "death test statement. Exception message: %s\n", \ +#if GTEST_HAS_EXCEPTIONS +#define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ + try { \ + GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ + } catch (const ::std::exception& gtest_exception) { \ + fprintf( \ + stderr, \ + "\n%s: Caught std::exception-derived exception escaping the " \ + "death test statement. Exception message: %s\n", \ ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \ - gtest_exception.what()); \ - fflush(stderr); \ + gtest_exception.what()); \ + fflush(stderr); \ death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \ - } catch (...) { \ + } catch (...) { \ death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \ } -# else -# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ +#else +#define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) -# endif +#endif // This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*, // ASSERT_EXIT*, and EXPECT_EXIT*. @@ -265,16 +267,12 @@ inline Matcher MakeDeathTestMatcher( // RUN_ALL_TESTS was called. class InternalRunDeathTestFlag { public: - InternalRunDeathTestFlag(const std::string& a_file, - int a_line, - int an_index, + InternalRunDeathTestFlag(const std::string& a_file, int a_line, int an_index, int a_write_fd) - : file_(a_file), line_(a_line), index_(an_index), - write_fd_(a_write_fd) {} + : file_(a_file), line_(a_line), index_(an_index), write_fd_(a_write_fd) {} ~InternalRunDeathTestFlag() { - if (write_fd_ >= 0) - posix::Close(write_fd_); + if (write_fd_ >= 0) posix::Close(write_fd_); } const std::string& file() const { return file_; } diff --git a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-filepath.h b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-filepath.h index c11b10151..328edb4f1 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-filepath.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-filepath.h @@ -61,8 +61,8 @@ namespace internal { class GTEST_API_ FilePath { public: - FilePath() : pathname_("") { } - FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { } + FilePath() : pathname_("") {} + FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) {} explicit FilePath(const std::string& pathname) : pathname_(pathname) { Normalize(); @@ -73,9 +73,7 @@ class GTEST_API_ FilePath { return *this; } - void Set(const FilePath& rhs) { - pathname_ = rhs.pathname_; - } + void Set(const FilePath& rhs) { pathname_ = rhs.pathname_; } const std::string& string() const { return pathname_; } const char* c_str() const { return pathname_.c_str(); } @@ -88,8 +86,7 @@ class GTEST_API_ FilePath { // than zero (e.g., 12), returns "dir/test_12.xml". // On Windows platform, uses \ as the separator rather than /. static FilePath MakeFileName(const FilePath& directory, - const FilePath& base_name, - int number, + const FilePath& base_name, int number, const char* extension); // Given directory = "dir", relative_path = "test.xml", diff --git a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-internal.h b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-internal.h index 028f21eb5..33113f666 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-internal.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-internal.h @@ -40,19 +40,20 @@ #include "gtest/internal/gtest-port.h" #if GTEST_OS_LINUX -# include -# include -# include -# include +#include +#include +#include +#include #endif // GTEST_OS_LINUX #if GTEST_HAS_EXCEPTIONS -# include +#include #endif #include #include #include + #include #include #include @@ -76,7 +77,7 @@ // the current line number. For more details, see // http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6 #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar) -#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar +#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo##bar // Stringifies its argument. // Work around a bug in visual studio which doesn't accept code like this: @@ -98,21 +99,21 @@ namespace testing { // Forward declarations. -class AssertionResult; // Result of an assertion. -class Message; // Represents a failure message. -class Test; // Represents a test. -class TestInfo; // Information about a test. -class TestPartResult; // Result of a test part. -class UnitTest; // A collection of test suites. +class AssertionResult; // Result of an assertion. +class Message; // Represents a failure message. +class Test; // Represents a test. +class TestInfo; // Information about a test. +class TestPartResult; // Result of a test part. +class UnitTest; // A collection of test suites. template ::std::string PrintToString(const T& value); namespace internal { -struct TraceInfo; // Information about a trace point. -class TestInfoImpl; // Opaque implementation of TestInfo -class UnitTestImpl; // Opaque implementation of UnitTest +struct TraceInfo; // Information about a trace point. +class TestInfoImpl; // Opaque implementation of TestInfo +class UnitTestImpl; // Opaque implementation of UnitTest // The text used in failure messages to indicate the start of the // stack trace. @@ -121,6 +122,7 @@ GTEST_API_ extern const char kStackTraceMarker[]; // An IgnoredValue object can be implicitly constructed from ANY value. class IgnoredValue { struct Sink {}; + public: // This constructor template allows any value to be implicitly // converted to IgnoredValue. The object has no data member and @@ -136,13 +138,13 @@ class IgnoredValue { }; // Appends the user-supplied message to the Google-Test-generated message. -GTEST_API_ std::string AppendUserMessage( - const std::string& gtest_msg, const Message& user_msg); +GTEST_API_ std::string AppendUserMessage(const std::string& gtest_msg, + const Message& user_msg); #if GTEST_HAS_EXCEPTIONS -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4275 \ -/* an exported class was derived from a class that was not exported */) +GTEST_DISABLE_MSC_WARNINGS_PUSH_( + 4275 /* an exported class was derived from a class that was not exported */) // This exception is thrown by (and only by) a failed Google Test // assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions @@ -212,10 +214,8 @@ GTEST_API_ AssertionResult EqFailure(const char* expected_expression, // Constructs a failure message for Boolean assertions such as EXPECT_TRUE. GTEST_API_ std::string GetBoolAssertionFailureMessage( - const AssertionResult& assertion_result, - const char* expression_text, - const char* actual_predicate_value, - const char* expected_predicate_value); + const AssertionResult& assertion_result, const char* expression_text, + const char* actual_predicate_value, const char* expected_predicate_value); // This template class represents an IEEE floating-point number // (either single-precision or double-precision, depending on the @@ -256,11 +256,11 @@ class FloatingPoint { // Constants. // # of bits in a number. - static const size_t kBitCount = 8*sizeof(RawType); + static const size_t kBitCount = 8 * sizeof(RawType); // # of fraction bits in a number. static const size_t kFractionBitCount = - std::numeric_limits::digits - 1; + std::numeric_limits::digits - 1; // # of exponent bits in a number. static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount; @@ -269,8 +269,8 @@ class FloatingPoint { static const Bits kSignBitMask = static_cast(1) << (kBitCount - 1); // The mask for the fraction bits. - static const Bits kFractionBitMask = - ~static_cast(0) >> (kExponentBitCount + 1); + static const Bits kFractionBitMask = ~static_cast(0) >> + (kExponentBitCount + 1); // The mask for the exponent bits. static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask); @@ -309,9 +309,7 @@ class FloatingPoint { } // Returns the floating-point number that represent positive infinity. - static RawType Infinity() { - return ReinterpretBits(kExponentBitMask); - } + static RawType Infinity() { return ReinterpretBits(kExponentBitMask); } // Returns the maximum representable finite floating-point number. static RawType Max(); @@ -319,7 +317,7 @@ class FloatingPoint { // Non-static methods // Returns the bits that represents this number. - const Bits &bits() const { return u_.bits_; } + const Bits& bits() const { return u_.bits_; } // Returns the exponent bits of this number. Bits exponent_bits() const { return kExponentBitMask & u_.bits_; } @@ -348,8 +346,8 @@ class FloatingPoint { // a NAN must return false. if (is_nan() || rhs.is_nan()) return false; - return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_) - <= kMaxUlps; + return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_) <= + kMaxUlps; } private: @@ -374,7 +372,7 @@ class FloatingPoint { // // Read http://en.wikipedia.org/wiki/Signed_number_representations // for more details on signed number representations. - static Bits SignAndMagnitudeToBiased(const Bits &sam) { + static Bits SignAndMagnitudeToBiased(const Bits& sam) { if (kSignBitMask & sam) { // sam represents a negative number. return ~sam + 1; @@ -386,8 +384,8 @@ class FloatingPoint { // Given two numbers in the sign-and-magnitude representation, // returns the distance between them as an unsigned number. - static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1, - const Bits &sam2) { + static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits& sam1, + const Bits& sam2) { const Bits biased1 = SignAndMagnitudeToBiased(sam1); const Bits biased2 = SignAndMagnitudeToBiased(sam2); return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1); @@ -399,9 +397,13 @@ class FloatingPoint { // We cannot use std::numeric_limits::max() as it clashes with the max() // macro defined by . template <> -inline float FloatingPoint::Max() { return FLT_MAX; } +inline float FloatingPoint::Max() { + return FLT_MAX; +} template <> -inline double FloatingPoint::Max() { return DBL_MAX; } +inline double FloatingPoint::Max() { + return DBL_MAX; +} // Typedefs the instances of the FloatingPoint template class that we // care to use. @@ -644,7 +646,8 @@ inline const char* SkipComma(const char* str) { if (comma == nullptr) { return nullptr; } - while (IsSpace(*(++comma))) {} + while (IsSpace(*(++comma))) { + } return comma; } @@ -658,7 +661,7 @@ inline std::string GetPrefixUntilComma(const char* str) { // Splits a given string on a given delimiter, populating a given // vector with the fields. void SplitString(const ::std::string& str, char delimiter, - ::std::vector< ::std::string>* dest); + ::std::vector<::std::string>* dest); // The default argument to the template below for the case when the user does // not provide a name generator. @@ -771,13 +774,13 @@ class TypeParameterizedTestSuite { const std::vector& type_names = GenerateNames()) { RegisterTypeParameterizedTestSuiteInstantiation(case_name); - std::string test_name = StripTrailingSpaces( - GetPrefixUntilComma(test_names)); + std::string test_name = + StripTrailingSpaces(GetPrefixUntilComma(test_names)); if (!state->TestExists(test_name)) { fprintf(stderr, "Failed to get code location for test %s.%s at %s.", case_name, test_name.c_str(), - FormatFileLocation(code_location.file.c_str(), - code_location.line).c_str()); + FormatFileLocation(code_location.file.c_str(), code_location.line) + .c_str()); fflush(stderr); posix::Abort(); } @@ -823,8 +826,8 @@ class TypeParameterizedTestSuite { // For example, if Foo() calls Bar(), which in turn calls // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. -GTEST_API_ std::string GetCurrentOsStackTraceExceptTop( - UnitTest* unit_test, int skip_count); +GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(UnitTest* unit_test, + int skip_count); // Helpers for suppressing warnings on unreachable code or constant // condition. @@ -923,7 +926,9 @@ IsContainer IsContainerTest(int /* dummy */) { typedef char IsNotContainer; template -IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; } +IsNotContainer IsContainerTest(long /* dummy */) { + return '\0'; +} // Trait to detect whether a type T is a hash table. // The heuristic used is that the type contains an inner type `hasher` and does @@ -986,11 +991,13 @@ bool ArrayEq(const T* lhs, size_t size, const U* rhs); // This generic version is used when k is 0. template -inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; } +inline bool ArrayEq(const T& lhs, const U& rhs) { + return lhs == rhs; +} // This overload is used when k >= 1. template -inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) { +inline bool ArrayEq(const T (&lhs)[N], const U (&rhs)[N]) { return internal::ArrayEq(lhs, N, rhs); } @@ -1000,8 +1007,7 @@ inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) { template bool ArrayEq(const T* lhs, size_t size, const U* rhs) { for (size_t i = 0; i != size; i++) { - if (!internal::ArrayEq(lhs[i], rhs[i])) - return false; + if (!internal::ArrayEq(lhs[i], rhs[i])) return false; } return true; } @@ -1011,8 +1017,7 @@ bool ArrayEq(const T* lhs, size_t size, const U* rhs) { template Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) { for (Iter it = begin; it != end; ++it) { - if (internal::ArrayEq(*it, elem)) - return it; + if (internal::ArrayEq(*it, elem)) return it; } return end; } @@ -1026,11 +1031,13 @@ void CopyArray(const T* from, size_t size, U* to); // This generic version is used when k is 0. template -inline void CopyArray(const T& from, U* to) { *to = from; } +inline void CopyArray(const T& from, U* to) { + *to = from; +} // This overload is used when k >= 1. template -inline void CopyArray(const T(&from)[N], U(*to)[N]) { +inline void CopyArray(const T (&from)[N], U (*to)[N]) { internal::CopyArray(from, N, *to); } @@ -1083,8 +1090,7 @@ class NativeArray { } ~NativeArray() { - if (clone_ != &NativeArray::InitRef) - delete[] array_; + if (clone_ != &NativeArray::InitRef) delete[] array_; } // STL-style container methods. @@ -1092,8 +1098,7 @@ class NativeArray { const_iterator begin() const { return array_; } const_iterator end() const { return array_ + size_; } bool operator==(const NativeArray& rhs) const { - return size() == rhs.size() && - ArrayEq(begin(), size(), rhs.begin()); + return size() == rhs.size() && ArrayEq(begin(), size(), rhs.begin()); } private: @@ -1261,9 +1266,9 @@ constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; } } // namespace internal } // namespace testing -#define GTEST_MESSAGE_AT_(file, line, message, result_type) \ - ::testing::internal::AssertHelper(result_type, file, line, message) \ - = ::testing::Message() +#define GTEST_MESSAGE_AT_(file, line, message, result_type) \ + ::testing::internal::AssertHelper(result_type, file, line, message) = \ + ::testing::Message() #define GTEST_MESSAGE_(message, result_type) \ GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type) @@ -1291,42 +1296,39 @@ constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; } } else /* NOLINT */ \ static_assert(true, "") // User must have a semicolon after expansion. -#define GTEST_TEST_THROW_(statement, expected_exception, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::ConstCharPtr gtest_msg = "") { \ - bool gtest_caught_expected = false; \ - try { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } \ - catch (expected_exception const&) { \ - gtest_caught_expected = true; \ - } \ - catch (...) { \ - gtest_msg.value = \ - "Expected: " #statement " throws an exception of type " \ - #expected_exception ".\n Actual: it throws a different type."; \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ - } \ - if (!gtest_caught_expected) { \ - gtest_msg.value = \ - "Expected: " #statement " throws an exception of type " \ - #expected_exception ".\n Actual: it throws nothing."; \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ - } \ - } else \ - GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \ - fail(gtest_msg.value) +#define GTEST_TEST_THROW_(statement, expected_exception, fail) \ + GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ + if (::testing::internal::ConstCharPtr gtest_msg = "") { \ + bool gtest_caught_expected = false; \ + try { \ + GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ + } catch (expected_exception const&) { \ + gtest_caught_expected = true; \ + } catch (...) { \ + gtest_msg.value = "Expected: " #statement \ + " throws an exception of type " #expected_exception \ + ".\n Actual: it throws a different type."; \ + goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ + } \ + if (!gtest_caught_expected) { \ + gtest_msg.value = "Expected: " #statement \ + " throws an exception of type " #expected_exception \ + ".\n Actual: it throws nothing."; \ + goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ + } \ + } else \ + GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__) \ + : fail(gtest_msg.value) #if GTEST_HAS_EXCEPTIONS -#define GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \ - catch (std::exception const& e) { \ - gtest_msg.value = ( \ - "it throws std::exception-derived exception with description: \"" \ - ); \ - gtest_msg.value += e.what(); \ - gtest_msg.value += "\"."; \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ +#define GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \ + catch (std::exception const& e) { \ + gtest_msg.value = \ + ("it throws std::exception-derived exception with description: \""); \ + gtest_msg.value += e.what(); \ + gtest_msg.value += "\"."; \ + goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ } #else // GTEST_HAS_EXCEPTIONS @@ -1335,66 +1337,69 @@ constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; } #endif // GTEST_HAS_EXCEPTIONS -#define GTEST_TEST_NO_THROW_(statement, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::TrueWithString gtest_msg{}) { \ - try { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } \ - GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \ - catch (...) { \ - gtest_msg.value = "it throws."; \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ - } \ - } else \ - GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \ - fail(("Expected: " #statement " doesn't throw an exception.\n" \ - " Actual: " + gtest_msg.value).c_str()) - -#define GTEST_TEST_ANY_THROW_(statement, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AlwaysTrue()) { \ - bool gtest_caught_any = false; \ - try { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } \ - catch (...) { \ - gtest_caught_any = true; \ - } \ - if (!gtest_caught_any) { \ +#define GTEST_TEST_NO_THROW_(statement, fail) \ + GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ + if (::testing::internal::TrueWithString gtest_msg{}) { \ + try { \ + GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ + } \ + GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \ + catch (...) { \ + gtest_msg.value = "it throws."; \ + goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ + } \ + } else \ + GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__) \ + : fail(("Expected: " #statement " doesn't throw an exception.\n" \ + " Actual: " + \ + gtest_msg.value) \ + .c_str()) + +#define GTEST_TEST_ANY_THROW_(statement, fail) \ + GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ + if (::testing::internal::AlwaysTrue()) { \ + bool gtest_caught_any = false; \ + try { \ + GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ + } catch (...) { \ + gtest_caught_any = true; \ + } \ + if (!gtest_caught_any) { \ goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \ - } \ - } else \ - GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \ - fail("Expected: " #statement " throws an exception.\n" \ - " Actual: it doesn't.") - + } \ + } else \ + GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__) \ + : fail("Expected: " #statement \ + " throws an exception.\n" \ + " Actual: it doesn't.") // Implements Boolean test assertions such as EXPECT_TRUE. expression can be // either a boolean expression or an AssertionResult. text is a textual // represenation of expression as it was passed into the EXPECT_TRUE. #define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (const ::testing::AssertionResult gtest_ar_ = \ - ::testing::AssertionResult(expression)) \ - ; \ - else \ - fail(::testing::internal::GetBoolAssertionFailureMessage(\ - gtest_ar_, text, #actual, #expected).c_str()) - -#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AlwaysTrue()) { \ + GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ + if (const ::testing::AssertionResult gtest_ar_ = \ + ::testing::AssertionResult(expression)) \ + ; \ + else \ + fail(::testing::internal::GetBoolAssertionFailureMessage( \ + gtest_ar_, text, #actual, #expected) \ + .c_str()) + +#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \ + GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ + if (::testing::internal::AlwaysTrue()) { \ ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \ - } \ - } else \ - GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \ - fail("Expected: " #statement " doesn't generate new fatal " \ - "failures in the current thread.\n" \ - " Actual: it does.") + GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ + if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \ + goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \ + } \ + } else \ + GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__) \ + : fail("Expected: " #statement \ + " doesn't generate new fatal " \ + "failures in the current thread.\n" \ + " Actual: it does.") // Expands to the name of the class that implements the given test. #define GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ diff --git a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-param-util.h b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-param-util.h index 14ce2dd8c..cfc694d90 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-param-util.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-param-util.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Type and function utilities for implementing parameterized tests. // GOOGLETEST_CM0001 DO NOT DELETE @@ -46,19 +45,18 @@ #include #include -#include "gtest/internal/gtest-internal.h" -#include "gtest/internal/gtest-port.h" #include "gtest/gtest-printers.h" #include "gtest/gtest-test-part.h" +#include "gtest/internal/gtest-internal.h" +#include "gtest/internal/gtest-port.h" namespace testing { // Input to a parameterized test name generator, describing a test parameter. // Consists of the parameter value and the integer parameter index. template struct TestParamInfo { - TestParamInfo(const ParamType& a_param, size_t an_index) : - param(a_param), - index(an_index) {} + TestParamInfo(const ParamType& a_param, size_t an_index) + : param(a_param), index(an_index) {} ParamType param; size_t index; }; @@ -84,8 +82,10 @@ namespace internal { GTEST_API_ void ReportInvalidTestSuiteType(const char* test_suite_name, CodeLocation code_location); -template class ParamGeneratorInterface; -template class ParamGenerator; +template +class ParamGeneratorInterface; +template +class ParamGenerator; // Interface for iterating over elements provided by an implementation // of ParamGeneratorInterface. @@ -129,8 +129,7 @@ class ParamIterator { // ParamIterator assumes ownership of the impl_ pointer. ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {} ParamIterator& operator=(const ParamIterator& other) { - if (this != &other) - impl_.reset(other.impl_->Clone()); + if (this != &other) impl_.reset(other.impl_->Clone()); return *this; } @@ -157,7 +156,7 @@ class ParamIterator { private: friend class ParamGenerator; explicit ParamIterator(ParamIteratorInterface* impl) : impl_(impl) {} - std::unique_ptr > impl_; + std::unique_ptr> impl_; }; // ParamGeneratorInterface is the binary interface to access generators @@ -179,7 +178,7 @@ class ParamGeneratorInterface { // This class implements copy initialization semantics and the contained // ParamGeneratorInterface instance is shared among all copies // of the original object. This is possible because that instance is immutable. -template +template class ParamGenerator { public: typedef ParamIterator iterator; @@ -196,7 +195,7 @@ class ParamGenerator { iterator end() const { return iterator(impl_->End()); } private: - std::shared_ptr > impl_; + std::shared_ptr> impl_; }; // Generates values from a range of two comparable values. Can be used to @@ -207,8 +206,10 @@ template class RangeGenerator : public ParamGeneratorInterface { public: RangeGenerator(T begin, T end, IncrementT step) - : begin_(begin), end_(end), - step_(step), end_index_(CalculateEndIndex(begin, end, step)) {} + : begin_(begin), + end_(end), + step_(step), + end_index_(CalculateEndIndex(begin, end, step)) {} ~RangeGenerator() override {} ParamIteratorInterface* Begin() const override { @@ -251,7 +252,9 @@ class RangeGenerator : public ParamGeneratorInterface { private: Iterator(const Iterator& other) : ParamIteratorInterface(), - base_(other.base_), value_(other.value_), index_(other.index_), + base_(other.base_), + value_(other.value_), + index_(other.index_), step_(other.step_) {} // No implementation - assignment is unsupported. @@ -263,12 +266,10 @@ class RangeGenerator : public ParamGeneratorInterface { const IncrementT step_; }; // class RangeGenerator::Iterator - static int CalculateEndIndex(const T& begin, - const T& end, + static int CalculateEndIndex(const T& begin, const T& end, const IncrementT& step) { int end_index = 0; - for (T i = begin; i < end; i = static_cast(i + step)) - end_index++; + for (T i = begin; i < end; i = static_cast(i + step)) end_index++; return end_index; } @@ -283,7 +284,6 @@ class RangeGenerator : public ParamGeneratorInterface { const int end_index_; }; // class RangeGenerator - // Generates values from a pair of STL-style iterators. Used in the // ValuesIn() function. The elements are copied from the source range // since the source can be located on the stack, and the generator @@ -341,13 +341,13 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface { << "The program attempted to compare iterators " << "from different generators." << std::endl; return iterator_ == - CheckedDowncastToActualType(&other)->iterator_; + CheckedDowncastToActualType(&other)->iterator_; } private: Iterator(const Iterator& other) - // The explicit constructor call suppresses a false warning - // emitted by gcc when supplied with the -Wextra option. + // The explicit constructor call suppresses a false warning + // emitted by gcc when supplied with the -Wextra option. : ParamIteratorInterface(), base_(other.base_), iterator_(other.iterator_) {} @@ -394,8 +394,8 @@ template class ParameterizedTestFactory : public TestFactoryBase { public: typedef typename TestClass::ParamType ParamType; - explicit ParameterizedTestFactory(ParamType parameter) : - parameter_(parameter) {} + explicit ParameterizedTestFactory(ParamType parameter) + : parameter_(parameter) {} Test* CreateTest() override { TestClass::SetParam(¶meter_); return new TestClass(); @@ -546,8 +546,8 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { test_it != tests_.end(); ++test_it) { std::shared_ptr test_info = *test_it; for (typename InstantiationContainer::iterator gen_it = - instantiations_.begin(); gen_it != instantiations_.end(); - ++gen_it) { + instantiations_.begin(); + gen_it != instantiations_.end(); ++gen_it) { const std::string& instantiation_name = gen_it->name; ParamGenerator generator((*gen_it->generator)()); ParamNameGeneratorFunc* name_func = gen_it->name_func; @@ -555,7 +555,7 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { int line = gen_it->line; std::string test_suite_name; - if ( !instantiation_name.empty() ) + if (!instantiation_name.empty()) test_suite_name = instantiation_name + "/"; test_suite_name += test_info->test_suite_base_name; @@ -568,17 +568,16 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { Message test_name_stream; - std::string param_name = name_func( - TestParamInfo(*param_it, i)); + std::string param_name = + name_func(TestParamInfo(*param_it, i)); GTEST_CHECK_(IsValidParamName(param_name)) << "Parameterized test name '" << param_name - << "' is invalid, in " << file - << " line " << line << std::endl; + << "' is invalid, in " << file << " line " << line << std::endl; GTEST_CHECK_(test_param_names.count(param_name) == 0) - << "Duplicate parameterized test name '" << param_name - << "', in " << file << " line " << line << std::endl; + << "Duplicate parameterized test name '" << param_name << "', in " + << file << " line " << line << std::endl; test_param_names.insert(param_name); @@ -603,7 +602,7 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { InsertSyntheticTestCase(GetTestSuiteName(), code_location_, !tests_.empty()); } - } // RegisterTests + } // RegisterTests private: // LocalTestInfo structure keeps information about a single test registered @@ -617,41 +616,38 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { const std::string test_suite_base_name; const std::string test_base_name; - const std::unique_ptr > test_meta_factory; + const std::unique_ptr> test_meta_factory; }; - using TestInfoContainer = ::std::vector >; + using TestInfoContainer = ::std::vector>; // Records data received from INSTANTIATE_TEST_SUITE_P macros: // struct InstantiationInfo { - InstantiationInfo(const std::string &name_in, - GeneratorCreationFunc* generator_in, - ParamNameGeneratorFunc* name_func_in, - const char* file_in, - int line_in) - : name(name_in), - generator(generator_in), - name_func(name_func_in), - file(file_in), - line(line_in) {} - - std::string name; - GeneratorCreationFunc* generator; - ParamNameGeneratorFunc* name_func; - const char* file; - int line; + InstantiationInfo(const std::string& name_in, + GeneratorCreationFunc* generator_in, + ParamNameGeneratorFunc* name_func_in, const char* file_in, + int line_in) + : name(name_in), + generator(generator_in), + name_func(name_func_in), + file(file_in), + line(line_in) {} + + std::string name; + GeneratorCreationFunc* generator; + ParamNameGeneratorFunc* name_func; + const char* file; + int line; }; typedef ::std::vector InstantiationContainer; static bool IsValidParamName(const std::string& name) { // Check for empty string - if (name.empty()) - return false; + if (name.empty()) return false; // Check for invalid characters for (std::string::size_type index = 0; index < name.size(); ++index) { - if (!isalnum(name[index]) && name[index] != '_') - return false; + if (!isalnum(name[index]) && name[index] != '_') return false; } return true; @@ -705,7 +701,7 @@ class ParameterizedTestSuiteRegistry { // type we are looking for, so we downcast it to that type // without further checks. typed_test_info = CheckedDowncastToActualType< - ParameterizedTestSuiteInfo >(test_suite_info); + ParameterizedTestSuiteInfo>(test_suite_info); } break; } @@ -823,7 +819,8 @@ class CartesianProductGenerator : public ParamIteratorInterface { public: IteratorImpl(const ParamGeneratorInterface* base, - const std::tuple...>& generators, bool is_end) + const std::tuple...>& generators, + bool is_end) : base_(base), begin_(std::get(generators).begin()...), end_(std::get(generators).end()...), diff --git a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-port-arch.h b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-port-arch.h index d3239b25b..f803a19be 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-port-arch.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-port-arch.h @@ -37,69 +37,69 @@ // Determines the platform on which Google Test is compiled. #ifdef __CYGWIN__ -# define GTEST_OS_CYGWIN 1 -# elif defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__) -# define GTEST_OS_WINDOWS_MINGW 1 -# define GTEST_OS_WINDOWS 1 +#define GTEST_OS_CYGWIN 1 +#elif defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__) +#define GTEST_OS_WINDOWS_MINGW 1 +#define GTEST_OS_WINDOWS 1 #elif defined _WIN32 -# define GTEST_OS_WINDOWS 1 -# ifdef _WIN32_WCE -# define GTEST_OS_WINDOWS_MOBILE 1 -# elif defined(WINAPI_FAMILY) -# include -# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -# define GTEST_OS_WINDOWS_DESKTOP 1 -# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) -# define GTEST_OS_WINDOWS_PHONE 1 -# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) -# define GTEST_OS_WINDOWS_RT 1 -# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE) -# define GTEST_OS_WINDOWS_PHONE 1 -# define GTEST_OS_WINDOWS_TV_TITLE 1 -# else - // WINAPI_FAMILY defined but no known partition matched. - // Default to desktop. -# define GTEST_OS_WINDOWS_DESKTOP 1 -# endif -# else -# define GTEST_OS_WINDOWS_DESKTOP 1 -# endif // _WIN32_WCE +#define GTEST_OS_WINDOWS 1 +#ifdef _WIN32_WCE +#define GTEST_OS_WINDOWS_MOBILE 1 +#elif defined(WINAPI_FAMILY) +#include +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +#define GTEST_OS_WINDOWS_DESKTOP 1 +#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) +#define GTEST_OS_WINDOWS_PHONE 1 +#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) +#define GTEST_OS_WINDOWS_RT 1 +#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE) +#define GTEST_OS_WINDOWS_PHONE 1 +#define GTEST_OS_WINDOWS_TV_TITLE 1 +#else +// WINAPI_FAMILY defined but no known partition matched. +// Default to desktop. +#define GTEST_OS_WINDOWS_DESKTOP 1 +#endif +#else +#define GTEST_OS_WINDOWS_DESKTOP 1 +#endif // _WIN32_WCE #elif defined __OS2__ -# define GTEST_OS_OS2 1 +#define GTEST_OS_OS2 1 #elif defined __APPLE__ -# define GTEST_OS_MAC 1 -# if TARGET_OS_IPHONE -# define GTEST_OS_IOS 1 -# endif +#define GTEST_OS_MAC 1 +#if TARGET_OS_IPHONE +#define GTEST_OS_IOS 1 +#endif #elif defined __DragonFly__ -# define GTEST_OS_DRAGONFLY 1 +#define GTEST_OS_DRAGONFLY 1 #elif defined __FreeBSD__ -# define GTEST_OS_FREEBSD 1 +#define GTEST_OS_FREEBSD 1 #elif defined __Fuchsia__ -# define GTEST_OS_FUCHSIA 1 +#define GTEST_OS_FUCHSIA 1 #elif defined(__GLIBC__) && defined(__FreeBSD_kernel__) -# define GTEST_OS_GNU_KFREEBSD 1 +#define GTEST_OS_GNU_KFREEBSD 1 #elif defined __linux__ -# define GTEST_OS_LINUX 1 -# if defined __ANDROID__ -# define GTEST_OS_LINUX_ANDROID 1 -# endif +#define GTEST_OS_LINUX 1 +#if defined __ANDROID__ +#define GTEST_OS_LINUX_ANDROID 1 +#endif #elif defined __MVS__ -# define GTEST_OS_ZOS 1 +#define GTEST_OS_ZOS 1 #elif defined(__sun) && defined(__SVR4) -# define GTEST_OS_SOLARIS 1 +#define GTEST_OS_SOLARIS 1 #elif defined(_AIX) -# define GTEST_OS_AIX 1 +#define GTEST_OS_AIX 1 #elif defined(__hpux) -# define GTEST_OS_HPUX 1 +#define GTEST_OS_HPUX 1 #elif defined __native_client__ -# define GTEST_OS_NACL 1 +#define GTEST_OS_NACL 1 #elif defined __NetBSD__ -# define GTEST_OS_NETBSD 1 +#define GTEST_OS_NETBSD 1 #elif defined __OpenBSD__ -# define GTEST_OS_OPENBSD 1 +#define GTEST_OS_OPENBSD 1 #elif defined __QNX__ -# define GTEST_OS_QNX 1 +#define GTEST_OS_QNX 1 #elif defined(__HAIKU__) #define GTEST_OS_HAIKU 1 #elif defined ESP8266 diff --git a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-port.h b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-port.h index 2c92a34b4..221cecba8 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-port.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-port.h @@ -268,13 +268,13 @@ #include #ifndef _WIN32_WCE -# include -# include +#include +#include #endif // !_WIN32_WCE #if defined __APPLE__ -# include -# include +#include +#include #endif #include // NOLINT @@ -288,23 +288,23 @@ #include "gtest/internal/gtest-port-arch.h" #if !defined(GTEST_DEV_EMAIL_) -# define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com" -# define GTEST_FLAG_PREFIX_ "gtest_" -# define GTEST_FLAG_PREFIX_DASH_ "gtest-" -# define GTEST_FLAG_PREFIX_UPPER_ "GTEST_" -# define GTEST_NAME_ "Google Test" -# define GTEST_PROJECT_URL_ "https://github.com/google/googletest/" +#define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com" +#define GTEST_FLAG_PREFIX_ "gtest_" +#define GTEST_FLAG_PREFIX_DASH_ "gtest-" +#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_" +#define GTEST_NAME_ "Google Test" +#define GTEST_PROJECT_URL_ "https://github.com/google/googletest/" #endif // !defined(GTEST_DEV_EMAIL_) #if !defined(GTEST_INIT_GOOGLE_TEST_NAME_) -# define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest" +#define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest" #endif // !defined(GTEST_INIT_GOOGLE_TEST_NAME_) // Determines the version of gcc that is used to compile this. #ifdef __GNUC__ // 40302 means version 4.3.2. -# define GTEST_GCC_VER_ \ - (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__) +#define GTEST_GCC_VER_ \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif // __GNUC__ // Macros for disabling Microsoft Visual C++ warnings. @@ -313,41 +313,37 @@ // /* code that triggers warnings C4800 and C4385 */ // GTEST_DISABLE_MSC_WARNINGS_POP_() #if defined(_MSC_VER) -# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \ - __pragma(warning(push)) \ - __pragma(warning(disable: warnings)) -# define GTEST_DISABLE_MSC_WARNINGS_POP_() \ - __pragma(warning(pop)) +#define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \ + __pragma(warning(push)) __pragma(warning(disable : warnings)) +#define GTEST_DISABLE_MSC_WARNINGS_POP_() __pragma(warning(pop)) #else // Not all compilers are MSVC -# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) -# define GTEST_DISABLE_MSC_WARNINGS_POP_() +#define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) +#define GTEST_DISABLE_MSC_WARNINGS_POP_() #endif // Clang on Windows does not understand MSVC's pragma warning. // We need clang-specific way to disable function deprecation warning. #ifdef __clang__ -# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \ - _Pragma("clang diagnostic ignored \"-Wdeprecated-implementations\"") -#define GTEST_DISABLE_MSC_DEPRECATED_POP_() \ - _Pragma("clang diagnostic pop") +#define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \ + _Pragma("clang diagnostic ignored \"-Wdeprecated-implementations\"") +#define GTEST_DISABLE_MSC_DEPRECATED_POP_() _Pragma("clang diagnostic pop") #else -# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \ - GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996) -# define GTEST_DISABLE_MSC_DEPRECATED_POP_() \ - GTEST_DISABLE_MSC_WARNINGS_POP_() +#define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \ + GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996) +#define GTEST_DISABLE_MSC_DEPRECATED_POP_() GTEST_DISABLE_MSC_WARNINGS_POP_() #endif // Brings in definitions for functions used in the testing::internal::posix // namespace (read, write, close, chdir, isatty, stat). We do not currently // use them on Windows Mobile. #if GTEST_OS_WINDOWS -# if !GTEST_OS_WINDOWS_MOBILE -# include -# include -# endif +#if !GTEST_OS_WINDOWS_MOBILE +#include +#include +#endif // In order to avoid having to include , use forward declaration #if GTEST_OS_WINDOWS_MINGW && !defined(__MINGW64_VERSION_MAJOR) // MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two @@ -363,24 +359,24 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // This assumes that non-Windows OSes provide unistd.h. For OSes where this // is not the case, we need to include headers that provide the functions // mentioned above. -# include -# include +#include +#include #endif // GTEST_OS_WINDOWS #if GTEST_OS_LINUX_ANDROID // Used to define __ANDROID_API__ matching the target NDK API level. -# include // NOLINT +#include // NOLINT #endif // Defines this to true if and only if Google Test can use POSIX regular // expressions. #ifndef GTEST_HAS_POSIX_RE -# if GTEST_OS_LINUX_ANDROID +#if GTEST_OS_LINUX_ANDROID // On Android, is only available starting with Gingerbread. -# define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9) -# else -# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS) -# endif +#define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9) +#else +#define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS) +#endif #endif #if GTEST_USES_PCRE @@ -392,39 +388,39 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // won't compile otherwise. We can #include it here as we already // included , which is guaranteed to define size_t through // . -# include // NOLINT +#include // NOLINT -# define GTEST_USES_POSIX_RE 1 +#define GTEST_USES_POSIX_RE 1 #elif GTEST_OS_WINDOWS // is not available on Windows. Use our own simple regex // implementation instead. -# define GTEST_USES_SIMPLE_RE 1 +#define GTEST_USES_SIMPLE_RE 1 #else // may not be available on this platform. Use our own // simple regex implementation instead. -# define GTEST_USES_SIMPLE_RE 1 +#define GTEST_USES_SIMPLE_RE 1 #endif // GTEST_USES_PCRE #ifndef GTEST_HAS_EXCEPTIONS // The user didn't tell us whether exceptions are enabled, so we need // to figure it out. -# if defined(_MSC_VER) && defined(_CPPUNWIND) +#if defined(_MSC_VER) && defined(_CPPUNWIND) // MSVC defines _CPPUNWIND to 1 if and only if exceptions are enabled. -# define GTEST_HAS_EXCEPTIONS 1 -# elif defined(__BORLANDC__) +#define GTEST_HAS_EXCEPTIONS 1 +#elif defined(__BORLANDC__) // C++Builder's implementation of the STL uses the _HAS_EXCEPTIONS // macro to enable exceptions, so we'll do the same. // Assumes that exceptions are enabled by default. -# ifndef _HAS_EXCEPTIONS -# define _HAS_EXCEPTIONS 1 -# endif // _HAS_EXCEPTIONS -# define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS -# elif defined(__clang__) +#ifndef _HAS_EXCEPTIONS +#define _HAS_EXCEPTIONS 1 +#endif // _HAS_EXCEPTIONS +#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS +#elif defined(__clang__) // clang defines __EXCEPTIONS if and only if exceptions are enabled before clang // 220714, but if and only if cleanups are enabled after that. In Obj-C++ files, // there can be cleanups for ObjC exceptions which also need cleanups, even if @@ -433,27 +429,27 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // cleanups prior to that. To reliably check for C++ exception availability with // clang, check for // __EXCEPTIONS && __has_feature(cxx_exceptions). -# define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions)) -# elif defined(__GNUC__) && __EXCEPTIONS +#define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions)) +#elif defined(__GNUC__) && __EXCEPTIONS // gcc defines __EXCEPTIONS to 1 if and only if exceptions are enabled. -# define GTEST_HAS_EXCEPTIONS 1 -# elif defined(__SUNPRO_CC) +#define GTEST_HAS_EXCEPTIONS 1 +#elif defined(__SUNPRO_CC) // Sun Pro CC supports exceptions. However, there is no compile-time way of // detecting whether they are enabled or not. Therefore, we assume that // they are enabled unless the user tells us otherwise. -# define GTEST_HAS_EXCEPTIONS 1 -# elif defined(__IBMCPP__) && __EXCEPTIONS +#define GTEST_HAS_EXCEPTIONS 1 +#elif defined(__IBMCPP__) && __EXCEPTIONS // xlC defines __EXCEPTIONS to 1 if and only if exceptions are enabled. -# define GTEST_HAS_EXCEPTIONS 1 -# elif defined(__HP_aCC) +#define GTEST_HAS_EXCEPTIONS 1 +#elif defined(__HP_aCC) // Exception handling is in effect by default in HP aCC compiler. It has to // be turned of by +noeh compiler option if desired. -# define GTEST_HAS_EXCEPTIONS 1 -# else +#define GTEST_HAS_EXCEPTIONS 1 +#else // For other compilers, we assume exceptions are disabled to be // conservative. -# define GTEST_HAS_EXCEPTIONS 0 -# endif // defined(_MSC_VER) || defined(__BORLANDC__) +#define GTEST_HAS_EXCEPTIONS 0 +#endif // defined(_MSC_VER) || defined(__BORLANDC__) #endif // GTEST_HAS_EXCEPTIONS #ifndef GTEST_HAS_STD_WSTRING @@ -473,63 +469,62 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // The user didn't tell us whether RTTI is enabled, so we need to // figure it out. -# ifdef _MSC_VER +#ifdef _MSC_VER #ifdef _CPPRTTI // MSVC defines this macro if and only if RTTI is enabled. -# define GTEST_HAS_RTTI 1 -# else -# define GTEST_HAS_RTTI 0 -# endif +#define GTEST_HAS_RTTI 1 +#else +#define GTEST_HAS_RTTI 0 +#endif // Starting with version 4.3.2, gcc defines __GXX_RTTI if and only if RTTI is // enabled. -# elif defined(__GNUC__) +#elif defined(__GNUC__) -# ifdef __GXX_RTTI +#ifdef __GXX_RTTI // When building against STLport with the Android NDK and with // -frtti -fno-exceptions, the build fails at link time with undefined // references to __cxa_bad_typeid. Note sure if STL or toolchain bug, // so disable RTTI when detected. -# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \ - !defined(__EXCEPTIONS) -# define GTEST_HAS_RTTI 0 -# else -# define GTEST_HAS_RTTI 1 -# endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS -# else -# define GTEST_HAS_RTTI 0 -# endif // __GXX_RTTI +#if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && !defined(__EXCEPTIONS) +#define GTEST_HAS_RTTI 0 +#else +#define GTEST_HAS_RTTI 1 +#endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS +#else +#define GTEST_HAS_RTTI 0 +#endif // __GXX_RTTI // Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends // using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the // first version with C++ support. -# elif defined(__clang__) +#elif defined(__clang__) -# define GTEST_HAS_RTTI __has_feature(cxx_rtti) +#define GTEST_HAS_RTTI __has_feature(cxx_rtti) // Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if // both the typeid and dynamic_cast features are present. -# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900) +#elif defined(__IBMCPP__) && (__IBMCPP__ >= 900) -# ifdef __RTTI_ALL__ -# define GTEST_HAS_RTTI 1 -# else -# define GTEST_HAS_RTTI 0 -# endif +#ifdef __RTTI_ALL__ +#define GTEST_HAS_RTTI 1 +#else +#define GTEST_HAS_RTTI 0 +#endif -# else +#else // For all other compilers, we assume RTTI is enabled. -# define GTEST_HAS_RTTI 1 +#define GTEST_HAS_RTTI 1 -# endif // _MSC_VER +#endif // _MSC_VER #endif // GTEST_HAS_RTTI // It's this header's responsibility to #include when RTTI // is enabled. #if GTEST_HAS_RTTI -# include +#include #endif // Determines whether Google Test can use the pthreads library. @@ -549,10 +544,10 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #if GTEST_HAS_PTHREAD // gtest-port.h guarantees to #include when GTEST_HAS_PTHREAD is // true. -# include // NOLINT +#include // NOLINT // For timespec and nanosleep, used below. -# include // NOLINT +#include // NOLINT #endif // Determines whether clone(2) is supported. @@ -562,24 +557,23 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #ifndef GTEST_HAS_CLONE // The user didn't tell us, so we need to figure it out. -# if GTEST_OS_LINUX && !defined(__ia64__) -# if GTEST_OS_LINUX_ANDROID +#if GTEST_OS_LINUX && !defined(__ia64__) +#if GTEST_OS_LINUX_ANDROID // On Android, clone() became available at different API levels for each 32-bit // architecture. -# if defined(__LP64__) || \ - (defined(__arm__) && __ANDROID_API__ >= 9) || \ - (defined(__mips__) && __ANDROID_API__ >= 12) || \ - (defined(__i386__) && __ANDROID_API__ >= 17) -# define GTEST_HAS_CLONE 1 -# else -# define GTEST_HAS_CLONE 0 -# endif -# else -# define GTEST_HAS_CLONE 1 -# endif -# else -# define GTEST_HAS_CLONE 0 -# endif // GTEST_OS_LINUX && !defined(__ia64__) +#if defined(__LP64__) || (defined(__arm__) && __ANDROID_API__ >= 9) || \ + (defined(__mips__) && __ANDROID_API__ >= 12) || \ + (defined(__i386__) && __ANDROID_API__ >= 17) +#define GTEST_HAS_CLONE 1 +#else +#define GTEST_HAS_CLONE 0 +#endif +#else +#define GTEST_HAS_CLONE 1 +#endif +#else +#define GTEST_HAS_CLONE 0 +#endif // GTEST_OS_LINUX && !defined(__ia64__) #endif // GTEST_HAS_CLONE @@ -590,10 +584,10 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // platforms except known mobile ones. #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \ GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 -# define GTEST_HAS_STREAM_REDIRECTION 0 -# else -# define GTEST_HAS_STREAM_REDIRECTION 1 -# endif // !GTEST_OS_WINDOWS_MOBILE +#define GTEST_HAS_STREAM_REDIRECTION 0 +#else +#define GTEST_HAS_STREAM_REDIRECTION 1 +#endif // !GTEST_OS_WINDOWS_MOBILE #endif // GTEST_HAS_STREAM_REDIRECTION // Determines whether to support death tests. @@ -604,7 +598,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; GTEST_OS_AIX || GTEST_OS_HPUX || GTEST_OS_OPENBSD || GTEST_OS_QNX || \ GTEST_OS_FREEBSD || GTEST_OS_NETBSD || GTEST_OS_FUCHSIA || \ GTEST_OS_DRAGONFLY || GTEST_OS_GNU_KFREEBSD || GTEST_OS_HAIKU) -# define GTEST_HAS_DEATH_TEST 1 +#define GTEST_HAS_DEATH_TEST 1 #endif // Determines whether to support type-driven tests. @@ -613,8 +607,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // Sun Pro CC, IBM Visual Age, and HP aCC support. #if defined(__GNUC__) || defined(_MSC_VER) || defined(__SUNPRO_CC) || \ defined(__IBMCPP__) || defined(__HP_aCC) -# define GTEST_HAS_TYPED_TEST 1 -# define GTEST_HAS_TYPED_TEST_P 1 +#define GTEST_HAS_TYPED_TEST 1 +#define GTEST_HAS_TYPED_TEST_P 1 #endif // Determines whether the system compiler uses UTF-16 for encoding wide strings. @@ -624,7 +618,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // Determines whether test results can be streamed to a socket. #if GTEST_OS_LINUX || GTEST_OS_GNU_KFREEBSD || GTEST_OS_DRAGONFLY || \ GTEST_OS_FREEBSD || GTEST_OS_NETBSD || GTEST_OS_OPENBSD -# define GTEST_CAN_STREAM_RESULTS_ 1 +#define GTEST_CAN_STREAM_RESULTS_ 1 #endif // Defines some utility macros. @@ -638,9 +632,12 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // // The "switch (0) case 0:" idiom is used to suppress this. #ifdef __INTEL_COMPILER -# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ +#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ #else -# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT +#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ + switch (0) \ + case 0: \ + default: // NOLINT #endif // Use this annotation at the end of a struct/class definition to @@ -655,38 +652,36 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // Also use it after a variable or parameter declaration to tell the // compiler the variable/parameter does not have to be used. #if defined(__GNUC__) && !defined(COMPILER_ICC) -# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) +#define GTEST_ATTRIBUTE_UNUSED_ __attribute__((unused)) #elif defined(__clang__) -# if __has_attribute(unused) -# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) -# endif +#if __has_attribute(unused) +#define GTEST_ATTRIBUTE_UNUSED_ __attribute__((unused)) +#endif #endif #ifndef GTEST_ATTRIBUTE_UNUSED_ -# define GTEST_ATTRIBUTE_UNUSED_ +#define GTEST_ATTRIBUTE_UNUSED_ #endif // Use this annotation before a function that takes a printf format string. #if (defined(__GNUC__) || defined(__clang__)) && !defined(COMPILER_ICC) -# if defined(__MINGW_PRINTF_FORMAT) +#if defined(__MINGW_PRINTF_FORMAT) // MinGW has two different printf implementations. Ensure the format macro // matches the selected implementation. See // https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/. -# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \ - __attribute__((__format__(__MINGW_PRINTF_FORMAT, string_index, \ - first_to_check))) -# else -# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \ - __attribute__((__format__(__printf__, string_index, first_to_check))) -# endif +#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \ + __attribute__(( \ + __format__(__MINGW_PRINTF_FORMAT, string_index, first_to_check))) #else -# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) +#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \ + __attribute__((__format__(__printf__, string_index, first_to_check))) +#endif +#else +#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) #endif - // A macro to disallow copy operator= // This should be used in the private: declarations for a class. -#define GTEST_DISALLOW_ASSIGN_(type) \ - type& operator=(type const &) = delete +#define GTEST_DISALLOW_ASSIGN_(type) type& operator=(type const&) = delete // A macro to disallow copy constructor and operator= // This should be used in the private: declarations for a class. @@ -697,7 +692,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // A macro to disallow move operator= // This should be used in the private: declarations for a class. #define GTEST_DISALLOW_MOVE_ASSIGN_(type) \ - type& operator=(type &&) noexcept = delete + type& operator=(type&&) noexcept = delete // A macro to disallow move constructor and operator= // This should be used in the private: declarations for a class. @@ -711,9 +706,9 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // // Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_; #if defined(__GNUC__) && !defined(COMPILER_ICC) -# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result)) +#define GTEST_MUST_USE_RESULT_ __attribute__((warn_unused_result)) #else -# define GTEST_MUST_USE_RESULT_ +#define GTEST_MUST_USE_RESULT_ #endif // __GNUC__ && !COMPILER_ICC // MS C++ compiler emits warning when a conditional expression is compile time @@ -724,10 +719,9 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // while (true) { // GTEST_INTENTIONAL_CONST_COND_POP_() // } -# define GTEST_INTENTIONAL_CONST_COND_PUSH_() \ - GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127) -# define GTEST_INTENTIONAL_CONST_COND_POP_() \ - GTEST_DISABLE_MSC_WARNINGS_POP_() +#define GTEST_INTENTIONAL_CONST_COND_PUSH_() \ + GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127) +#define GTEST_INTENTIONAL_CONST_COND_POP_() GTEST_DISABLE_MSC_WARNINGS_POP_() // Determine whether the compiler supports Microsoft's Structured Exception // Handling. This is supported by several Windows compilers but generally @@ -735,13 +729,13 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #ifndef GTEST_HAS_SEH // The user didn't tell us, so we need to figure it out. -# if defined(_MSC_VER) || defined(__BORLANDC__) +#if defined(_MSC_VER) || defined(__BORLANDC__) // These two compilers are known to support SEH. -# define GTEST_HAS_SEH 1 -# else +#define GTEST_HAS_SEH 1 +#else // Assume no SEH. -# define GTEST_HAS_SEH 0 -# endif +#define GTEST_HAS_SEH 0 +#endif #endif // GTEST_HAS_SEH @@ -760,88 +754,86 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #ifndef GTEST_API_ #ifdef _MSC_VER -# if GTEST_LINKED_AS_SHARED_LIBRARY -# define GTEST_API_ __declspec(dllimport) -# elif GTEST_CREATE_SHARED_LIBRARY -# define GTEST_API_ __declspec(dllexport) -# endif +#if GTEST_LINKED_AS_SHARED_LIBRARY +#define GTEST_API_ __declspec(dllimport) +#elif GTEST_CREATE_SHARED_LIBRARY +#define GTEST_API_ __declspec(dllexport) +#endif #elif __GNUC__ >= 4 || defined(__clang__) -# define GTEST_API_ __attribute__((visibility ("default"))) +#define GTEST_API_ __attribute__((visibility("default"))) #endif // _MSC_VER #endif // GTEST_API_ #ifndef GTEST_API_ -# define GTEST_API_ +#define GTEST_API_ #endif // GTEST_API_ #ifndef GTEST_DEFAULT_DEATH_TEST_STYLE -# define GTEST_DEFAULT_DEATH_TEST_STYLE "fast" +#define GTEST_DEFAULT_DEATH_TEST_STYLE "fast" #endif // GTEST_DEFAULT_DEATH_TEST_STYLE #ifdef __GNUC__ // Ask the compiler to never inline a given function. -# define GTEST_NO_INLINE_ __attribute__((noinline)) +#define GTEST_NO_INLINE_ __attribute__((noinline)) #else -# define GTEST_NO_INLINE_ +#define GTEST_NO_INLINE_ #endif // _LIBCPP_VERSION is defined by the libc++ library from the LLVM project. #if !defined(GTEST_HAS_CXXABI_H_) -# if defined(__GLIBCXX__) || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)) -# define GTEST_HAS_CXXABI_H_ 1 -# else -# define GTEST_HAS_CXXABI_H_ 0 -# endif +#if defined(__GLIBCXX__) || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)) +#define GTEST_HAS_CXXABI_H_ 1 +#else +#define GTEST_HAS_CXXABI_H_ 0 +#endif #endif // A function level attribute to disable checking for use of uninitialized // memory when built with MemorySanitizer. #if defined(__clang__) -# if __has_feature(memory_sanitizer) -# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \ - __attribute__((no_sanitize_memory)) -# else -# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ -# endif // __has_feature(memory_sanitizer) +#if __has_feature(memory_sanitizer) +#define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ __attribute__((no_sanitize_memory)) +#else +#define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ +#endif // __has_feature(memory_sanitizer) #else -# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ +#define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ #endif // __clang__ // A function level attribute to disable AddressSanitizer instrumentation. #if defined(__clang__) -# if __has_feature(address_sanitizer) -# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \ - __attribute__((no_sanitize_address)) -# else -# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -# endif // __has_feature(address_sanitizer) +#if __has_feature(address_sanitizer) +#define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \ + __attribute__((no_sanitize_address)) #else -# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ +#define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ +#endif // __has_feature(address_sanitizer) +#else +#define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ #endif // __clang__ // A function level attribute to disable HWAddressSanitizer instrumentation. #if defined(__clang__) -# if __has_feature(hwaddress_sanitizer) -# define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ \ - __attribute__((no_sanitize("hwaddress"))) -# else -# define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -# endif // __has_feature(hwaddress_sanitizer) +#if __has_feature(hwaddress_sanitizer) +#define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ \ + __attribute__((no_sanitize("hwaddress"))) +#else +#define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ +#endif // __has_feature(hwaddress_sanitizer) #else -# define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ +#define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ #endif // __clang__ // A function level attribute to disable ThreadSanitizer instrumentation. #if defined(__clang__) -# if __has_feature(thread_sanitizer) -# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \ - __attribute__((no_sanitize_thread)) -# else -# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ -# endif // __has_feature(thread_sanitizer) +#if __has_feature(thread_sanitizer) +#define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ __attribute__((no_sanitize_thread)) #else -# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ +#define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ +#endif // __has_feature(thread_sanitizer) +#else +#define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ #endif // __clang__ namespace testing { @@ -920,16 +912,16 @@ class GTEST_API_ RE { const char* pattern_; bool is_valid_; -# if GTEST_USES_POSIX_RE +#if GTEST_USES_POSIX_RE regex_t full_regex_; // For FullMatch(). regex_t partial_regex_; // For PartialMatch(). -# else // GTEST_USES_SIMPLE_RE +#else // GTEST_USES_SIMPLE_RE const char* full_pattern_; // For FullMatch(); -# endif +#endif }; #endif // GTEST_USES_PCRE @@ -950,12 +942,7 @@ GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file, // LogToStderr() - directs all log messages to stderr. // FlushInfoLog() - flushes informational log messages. -enum GTestLogSeverity { - GTEST_INFO, - GTEST_WARNING, - GTEST_ERROR, - GTEST_FATAL -}; +enum GTestLogSeverity { GTEST_INFO, GTEST_WARNING, GTEST_ERROR, GTEST_FATAL }; // Formats log entry severity, provides a stream object for streaming the // log message, and terminates the message with a newline when going out of @@ -977,9 +964,10 @@ class GTEST_API_ GTestLog { #if !defined(GTEST_LOG_) -# define GTEST_LOG_(severity) \ - ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \ - __FILE__, __LINE__).GetStream() +#define GTEST_LOG_(severity) \ + ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \ + __FILE__, __LINE__) \ + .GetStream() inline void LogToStderr() {} inline void FlushInfoLog() { fflush(nullptr); } @@ -1001,12 +989,12 @@ inline void FlushInfoLog() { fflush(nullptr); } // condition itself, plus additional message streamed into it, if any, // and then it aborts the program. It aborts the program irrespective of // whether it is built in the debug mode or not. -# define GTEST_CHECK_(condition) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::IsTrue(condition)) \ - ; \ - else \ - GTEST_LOG_(FATAL) << "Condition " #condition " failed. " +#define GTEST_CHECK_(condition) \ + GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ + if (::testing::internal::IsTrue(condition)) \ + ; \ + else \ + GTEST_LOG_(FATAL) << "Condition " #condition " failed. " #endif // !defined(GTEST_CHECK_) // An all-mode assert to verify that the given POSIX-style function @@ -1015,9 +1003,8 @@ inline void FlushInfoLog() { fflush(nullptr); } // in {} if you need to use it as the only statement in an 'if' // branch. #define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \ - if (const int gtest_error = (posix_call)) \ - GTEST_LOG_(FATAL) << #posix_call << "failed with error " \ - << gtest_error + if (const int gtest_error = (posix_call)) \ + GTEST_LOG_(FATAL) << #posix_call << "failed with error " << gtest_error // Transforms "T" into "const T&" according to standard reference collapsing // rules (this is only needed as a backport for C++98 compilers that do not @@ -1031,9 +1018,13 @@ inline void FlushInfoLog() { fflush(nullptr); } // Note that the non-const reference will not have "const" added. This is // standard, and necessary so that "T" can always bind to "const T&". template -struct ConstRef { typedef const T& type; }; +struct ConstRef { + typedef const T& type; +}; template -struct ConstRef { typedef T& type; }; +struct ConstRef { + typedef T& type; +}; // The argument T must depend on some template parameters. #define GTEST_REFERENCE_TO_CONST_(T) \ @@ -1059,8 +1050,10 @@ struct ConstRef { typedef T& type; }; // This relatively ugly name is intentional. It prevents clashes with // similar functions users may have (e.g., implicit_cast). The internal // namespace alone is not enough because the function can be found by ADL. -template -inline To ImplicitCast_(To x) { return x; } +template +inline To ImplicitCast_(To x) { + return x; +} // When you upcast (that is, cast a pointer from type Foo to type // SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts @@ -1083,17 +1076,17 @@ inline To ImplicitCast_(To x) { return x; } // This relatively ugly name is intentional. It prevents clashes with // similar functions users may have (e.g., down_cast). The internal // namespace alone is not enough because the function can be found by ADL. -template // use like this: DownCast_(foo); -inline To DownCast_(From* f) { // so we only accept pointers +template // use like this: DownCast_(foo); +inline To DownCast_(From* f) { // so we only accept pointers // Ensures that To is a sub-type of From *. This test is here only // for compile-time type checking, and has no overhead in an // optimized build at run-time, as it will be optimized away // completely. GTEST_INTENTIONAL_CONST_COND_PUSH_() if (false) { - GTEST_INTENTIONAL_CONST_COND_POP_() - const To to = nullptr; - ::testing::internal::ImplicitCast_(to); + GTEST_INTENTIONAL_CONST_COND_POP_() + const To to = nullptr; + ::testing::internal::ImplicitCast_(to); } #if GTEST_HAS_RTTI @@ -1158,24 +1151,24 @@ void ClearInjectableArgvs(); // Defines synchronization primitives. #if GTEST_IS_THREADSAFE -# if GTEST_HAS_PTHREAD +#if GTEST_HAS_PTHREAD // Sleeps for (roughly) n milliseconds. This function is only for testing // Google Test's own constructs. Don't use it in user tests, either // directly or indirectly. inline void SleepMilliseconds(int n) { const timespec time = { - 0, // 0 seconds. - n * 1000L * 1000L, // And n ms. + 0, // 0 seconds. + n * 1000L * 1000L, // And n ms. }; nanosleep(&time, nullptr); } -# endif // GTEST_HAS_PTHREAD +#endif // GTEST_HAS_PTHREAD -# if GTEST_HAS_NOTIFICATION_ +#if GTEST_HAS_NOTIFICATION_ // Notification has already been imported into the namespace. // Nothing to do here. -# elif GTEST_HAS_PTHREAD +#elif GTEST_HAS_PTHREAD // Allows a controller thread to pause execution of newly created // threads until notified. Instances of this class must be created // and destroyed in the controller thread. @@ -1187,9 +1180,7 @@ class Notification { Notification() : notified_(false) { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, nullptr)); } - ~Notification() { - pthread_mutex_destroy(&mutex_); - } + ~Notification() { pthread_mutex_destroy(&mutex_); } // Notifies all threads created with this notification to start. Must // be called from the controller thread. @@ -1206,8 +1197,7 @@ class Notification { pthread_mutex_lock(&mutex_); const bool notified = notified_; pthread_mutex_unlock(&mutex_); - if (notified) - break; + if (notified) break; SleepMilliseconds(10); } } @@ -1219,7 +1209,7 @@ class Notification { GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification); }; -# elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT +#elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT GTEST_API_ void SleepMilliseconds(int n); @@ -1269,12 +1259,12 @@ class GTEST_API_ Notification { GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification); }; -# endif // GTEST_HAS_NOTIFICATION_ +#endif // GTEST_HAS_NOTIFICATION_ // On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD // defined, but we don't want to use MinGW's pthreads implementation, which // has conformance problems with some versions of the POSIX standard. -# if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW +#if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW // As a C-function, ThreadFuncWithCLinkage cannot be templated itself. // Consequently, it cannot select a correct instantiation of ThreadWithParam @@ -1352,14 +1342,14 @@ class ThreadWithParam : public ThreadWithParamBase { GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam); }; -# endif // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD || - // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ +#endif // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD || + // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ -# if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ +#if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ // Mutex and ThreadLocal have already been imported into the namespace. // Nothing to do here. -# elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT +#elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT // Mutex implements mutex on Windows platforms. It is used in conjunction // with class MutexLock: @@ -1416,11 +1406,11 @@ class GTEST_API_ Mutex { GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex); }; -# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ - extern ::testing::internal::Mutex mutex +#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ + extern ::testing::internal::Mutex mutex -# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ - ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex) +#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ + ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex) // We cannot name this class MutexLock because the ctor declaration would // conflict with a macro named MutexLock, which is defined on some @@ -1429,8 +1419,7 @@ class GTEST_API_ Mutex { // "MutexLock l(&mu)". Hence the typedef trick below. class GTestMutexLock { public: - explicit GTestMutexLock(Mutex* mutex) - : mutex_(mutex) { mutex_->Lock(); } + explicit GTestMutexLock(Mutex* mutex) : mutex_(mutex) { mutex_->Lock(); } ~GTestMutexLock() { mutex_->Unlock(); } @@ -1493,7 +1482,7 @@ class GTEST_API_ ThreadWithParamBase { virtual void Run() = 0; }; - ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start); + ThreadWithParamBase(Runnable* runnable, Notification* thread_can_start); virtual ~ThreadWithParamBase(); private: @@ -1507,21 +1496,15 @@ class ThreadWithParam : public ThreadWithParamBase { typedef void UserThreadFunc(T); ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start) - : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) { - } + : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {} virtual ~ThreadWithParam() {} private: class RunnableImpl : public Runnable { public: - RunnableImpl(UserThreadFunc* func, T param) - : func_(func), - param_(param) { - } + RunnableImpl(UserThreadFunc* func, T param) : func_(func), param_(param) {} virtual ~RunnableImpl() {} - virtual void Run() { - func_(param_); - } + virtual void Run() { func_(param_); } private: UserThreadFunc* const func_; @@ -1589,10 +1572,10 @@ class ThreadLocal : public ThreadLocalBase { GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder); }; - T* GetOrCreateValue() const { return static_cast( - ThreadLocalRegistry::GetValueOnCurrentThread(this))->pointer(); + ThreadLocalRegistry::GetValueOnCurrentThread(this)) + ->pointer(); } virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const { @@ -1636,7 +1619,7 @@ class ThreadLocal : public ThreadLocalBase { GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal); }; -# elif GTEST_HAS_PTHREAD +#elif GTEST_HAS_PTHREAD // MutexBase and Mutex implement mutex on pthreads-based platforms. class MutexBase { @@ -1683,8 +1666,8 @@ class MutexBase { }; // Forward-declares a static mutex. -# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ - extern ::testing::internal::MutexBase mutex +#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ + extern ::testing::internal::MutexBase mutex // Defines and statically (i.e. at link time) initializes a static mutex. // The initialization list here does not explicitly initialize each field, @@ -1703,9 +1686,7 @@ class Mutex : public MutexBase { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, nullptr)); has_owner_ = false; } - ~Mutex() { - GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_)); - } + ~Mutex() { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_)); } private: GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex); @@ -1718,8 +1699,7 @@ class Mutex : public MutexBase { // "MutexLock l(&mu)". Hence the typedef trick below. class GTestMutexLock { public: - explicit GTestMutexLock(MutexBase* mutex) - : mutex_(mutex) { mutex_->Lock(); } + explicit GTestMutexLock(MutexBase* mutex) : mutex_(mutex) { mutex_->Lock(); } ~GTestMutexLock() { mutex_->Unlock(); } @@ -1847,7 +1827,7 @@ class GTEST_API_ ThreadLocal { GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal); }; -# endif // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ +#endif // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ #else // GTEST_IS_THREADSAFE @@ -1864,10 +1844,10 @@ class Mutex { void AssertHeld() const {} }; -# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ +#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ extern ::testing::internal::Mutex mutex -# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex +#define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex // We cannot name this class MutexLock because the ctor declaration would // conflict with a macro named MutexLock, which is defined on some @@ -1890,6 +1870,7 @@ class GTEST_API_ ThreadLocal { const T* pointer() const { return &value_; } const T& get() const { return value_; } void set(const T& value) { value_ = value; } + private: T value_; }; @@ -1901,11 +1882,11 @@ class GTEST_API_ ThreadLocal { GTEST_API_ size_t GetThreadCount(); #if GTEST_OS_WINDOWS -# define GTEST_PATH_SEP_ "\\" -# define GTEST_HAS_ALT_PATH_SEP_ 1 +#define GTEST_PATH_SEP_ "\\" +#define GTEST_HAS_ALT_PATH_SEP_ 1 #else -# define GTEST_PATH_SEP_ "/" -# define GTEST_HAS_ALT_PATH_SEP_ 0 +#define GTEST_PATH_SEP_ "/" +#define GTEST_HAS_ALT_PATH_SEP_ 0 #endif // GTEST_OS_WINDOWS // Utilities for char. @@ -1950,8 +1931,7 @@ inline char ToUpper(char ch) { inline std::string StripTrailingSpaces(std::string str) { std::string::iterator it = str.end(); - while (it != str.begin() && IsSpace(*--it)) - it = str.erase(it); + while (it != str.begin() && IsSpace(*--it)) it = str.erase(it); return str; } @@ -1969,36 +1949,34 @@ namespace posix { typedef struct _stat StatStruct; -# ifdef __BORLANDC__ +#ifdef __BORLANDC__ inline int DoIsATTY(int fd) { return isatty(fd); } inline int StrCaseCmp(const char* s1, const char* s2) { return stricmp(s1, s2); } inline char* StrDup(const char* src) { return strdup(src); } -# else // !__BORLANDC__ -# if GTEST_OS_WINDOWS_MOBILE +#else // !__BORLANDC__ +#if GTEST_OS_WINDOWS_MOBILE inline int DoIsATTY(int /* fd */) { return 0; } -# else +#else inline int DoIsATTY(int fd) { return _isatty(fd); } -# endif // GTEST_OS_WINDOWS_MOBILE +#endif // GTEST_OS_WINDOWS_MOBILE inline int StrCaseCmp(const char* s1, const char* s2) { return _stricmp(s1, s2); } inline char* StrDup(const char* src) { return _strdup(src); } -# endif // __BORLANDC__ +#endif // __BORLANDC__ -# if GTEST_OS_WINDOWS_MOBILE +#if GTEST_OS_WINDOWS_MOBILE inline int FileNo(FILE* file) { return reinterpret_cast(_fileno(file)); } // Stat(), RmDir(), and IsDir() are not needed on Windows CE at this // time and thus not defined there. -# else +#else inline int FileNo(FILE* file) { return _fileno(file); } inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); } inline int RmDir(const char* dir) { return _rmdir(dir); } -inline bool IsDir(const StatStruct& st) { - return (_S_IFDIR & st.st_mode) != 0; -} -# endif // GTEST_OS_WINDOWS_MOBILE +inline bool IsDir(const StatStruct& st) { return (_S_IFDIR & st.st_mode) != 0; } +#endif // GTEST_OS_WINDOWS_MOBILE #elif GTEST_OS_ESP8266 typedef struct stat StatStruct; @@ -2066,7 +2044,7 @@ inline FILE* FOpen(const char* path, const char* mode) { #endif // GTEST_OS_WINDOWS } #if !GTEST_OS_WINDOWS_MOBILE -inline FILE *FReopen(const char* path, const char* mode, FILE* stream) { +inline FILE* FReopen(const char* path, const char* mode, FILE* stream) { return freopen(path, mode, stream); } inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); } @@ -2118,13 +2096,13 @@ GTEST_DISABLE_MSC_DEPRECATED_POP_() // snprintf is a variadic function. #if _MSC_VER && !GTEST_OS_WINDOWS_MOBILE // MSVC 2005 and above support variadic macros. -# define GTEST_SNPRINTF_(buffer, size, format, ...) \ - _snprintf_s(buffer, size, size, format, __VA_ARGS__) +#define GTEST_SNPRINTF_(buffer, size, format, ...) \ + _snprintf_s(buffer, size, size, format, __VA_ARGS__) #elif defined(_MSC_VER) // Windows CE does not define _snprintf_s -# define GTEST_SNPRINTF_ _snprintf +#define GTEST_SNPRINTF_ _snprintf #else -# define GTEST_SNPRINTF_ snprintf +#define GTEST_SNPRINTF_ snprintf #endif // The biggest signed integer type the compiler supports. @@ -2184,37 +2162,37 @@ using TimeInMillis = int64_t; // Represents time in milliseconds. // Macro for referencing flags. #if !defined(GTEST_FLAG) -# define GTEST_FLAG(name) FLAGS_gtest_##name +#define GTEST_FLAG(name) FLAGS_gtest_##name #endif // !defined(GTEST_FLAG) #if !defined(GTEST_USE_OWN_FLAGFILE_FLAG_) -# define GTEST_USE_OWN_FLAGFILE_FLAG_ 1 +#define GTEST_USE_OWN_FLAGFILE_FLAG_ 1 #endif // !defined(GTEST_USE_OWN_FLAGFILE_FLAG_) #if !defined(GTEST_DECLARE_bool_) -# define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver +#define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver // Macros for declaring flags. -# define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name) -# define GTEST_DECLARE_int32_(name) \ - GTEST_API_ extern std::int32_t GTEST_FLAG(name) -# define GTEST_DECLARE_string_(name) \ - GTEST_API_ extern ::std::string GTEST_FLAG(name) +#define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name) +#define GTEST_DECLARE_int32_(name) \ + GTEST_API_ extern std::int32_t GTEST_FLAG(name) +#define GTEST_DECLARE_string_(name) \ + GTEST_API_ extern ::std::string GTEST_FLAG(name) // Macros for defining flags. -# define GTEST_DEFINE_bool_(name, default_val, doc) \ - GTEST_API_ bool GTEST_FLAG(name) = (default_val) -# define GTEST_DEFINE_int32_(name, default_val, doc) \ - GTEST_API_ std::int32_t GTEST_FLAG(name) = (default_val) -# define GTEST_DEFINE_string_(name, default_val, doc) \ - GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val) +#define GTEST_DEFINE_bool_(name, default_val, doc) \ + GTEST_API_ bool GTEST_FLAG(name) = (default_val) +#define GTEST_DEFINE_int32_(name, default_val, doc) \ + GTEST_API_ std::int32_t GTEST_FLAG(name) = (default_val) +#define GTEST_DEFINE_string_(name, default_val, doc) \ + GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val) #endif // !defined(GTEST_DECLARE_bool_) // Thread annotations #if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_) -# define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks) -# define GTEST_LOCK_EXCLUDED_(locks) +#define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks) +#define GTEST_LOCK_EXCLUDED_(locks) #endif // !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_) // Parses 'str' for a 32-bit signed integer. If successful, writes the result @@ -2314,7 +2292,7 @@ using Optional = ::std::optional; #if GTEST_HAS_ABSL // Always use absl::string_view for Matcher<> specializations if googletest // is built with absl support. -# define GTEST_INTERNAL_HAS_STRING_VIEW 1 +#define GTEST_INTERNAL_HAS_STRING_VIEW 1 #include "absl/strings/string_view.h" namespace testing { namespace internal { @@ -2322,11 +2300,11 @@ using StringView = ::absl::string_view; } // namespace internal } // namespace testing #else -# ifdef __has_include -# if __has_include() && __cplusplus >= 201703L +#ifdef __has_include +#if __has_include() && __cplusplus >= 201703L // Otherwise for C++17 and higher use std::string_view for Matcher<> // specializations. -# define GTEST_INTERNAL_HAS_STRING_VIEW 1 +#define GTEST_INTERNAL_HAS_STRING_VIEW 1 #include namespace testing { namespace internal { @@ -2335,8 +2313,8 @@ using StringView = ::std::string_view; } // namespace testing // The case where absl is configured NOT to alias std::string_view is not // supported. -# endif // __has_include() && __cplusplus >= 201703L -# endif // __has_include +#endif // __has_include() && __cplusplus >= 201703L +#endif // __has_include #endif // GTEST_HAS_ABSL #if GTEST_HAS_ABSL diff --git a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-string.h b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-string.h index 0b2a91a5d..5ee059e5b 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-string.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-string.h @@ -43,10 +43,11 @@ #ifdef __BORLANDC__ // string.h is not guaranteed to provide strcpy on C++ Builder. -# include +#include #endif #include + #include #include @@ -123,8 +124,7 @@ class GTEST_API_ String { // Unlike strcasecmp(), this function can handle NULL argument(s). // A NULL C string is considered different to any non-NULL C string, // including the empty string. - static bool CaseInsensitiveCStringEquals(const char* lhs, - const char* rhs); + static bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs); // Compares two wide C strings, ignoring case. Returns true if and only if // they have the same content. @@ -143,8 +143,8 @@ class GTEST_API_ String { // Returns true if and only if the given string ends with the given suffix, // ignoring case. Any string is considered to end with an empty suffix. - static bool EndsWithCaseInsensitive( - const std::string& str, const std::string& suffix); + static bool EndsWithCaseInsensitive(const std::string& str, + const std::string& suffix); // Formats an int value as "%02d". static std::string FormatIntWidth2(int value); // "%02d" for width == 2 diff --git a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-type-util.h b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-type-util.h index c3326f2c5..77d390d8a 100644 --- a/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-type-util.h +++ b/Testing/lib/googletest-master/googletest/include/gtest/internal/gtest-type-util.h @@ -39,11 +39,11 @@ // #ifdef __GNUC__ is too general here. It is possible to use gcc without using // libstdc++ (which is where cxxabi.h comes from). -# if GTEST_HAS_CXXABI_H_ -# include -# elif defined(__HP_aCC) -# include -# endif // GTEST_HASH_CXXABI_H_ +#if GTEST_HAS_CXXABI_H_ +#include +#elif defined(__HP_aCC) +#include +#endif // GTEST_HASH_CXXABI_H_ namespace testing { namespace internal { @@ -103,7 +103,9 @@ std::string GetTypeName() { // A unique type indicating an empty node struct None {}; -# define GTEST_TEMPLATE_ template class +#define GTEST_TEMPLATE_ \ + template \ + class // The template "selector" struct TemplateSel is used to // represent Tmpl, which must be a class template with one type @@ -121,8 +123,7 @@ struct TemplateSel { }; }; -# define GTEST_BIND_(TmplSel, T) \ - TmplSel::template Bind::type +#define GTEST_BIND_(TmplSel, T) TmplSel::template Bind::type template struct Templates { diff --git a/Testing/lib/googletest-master/googletest/samples/prime_tables.h b/Testing/lib/googletest-master/googletest/samples/prime_tables.h index 34002f3d6..2645a0424 100644 --- a/Testing/lib/googletest-master/googletest/samples/prime_tables.h +++ b/Testing/lib/googletest-master/googletest/samples/prime_tables.h @@ -27,8 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - // This provides interface PrimeTable that determines whether a number is a // prime and determines a next prime number. This interface is used // in Google Test samples demonstrating use of parameterized tests. @@ -57,7 +55,7 @@ class OnTheFlyPrimeTable : public PrimeTable { bool IsPrime(int n) const override { if (n <= 1) return false; - for (int i = 2; i*i <= n; i++) { + for (int i = 2; i * i <= n; i++) { // n is divisible by an integer other than 1 and itself. if ((n % i) == 0) return false; } @@ -104,13 +102,13 @@ class PreCalculatedPrimeTable : public PrimeTable { // Checks every candidate for prime number (we know that 2 is the only even // prime). - for (int i = 2; i*i <= max; i += i%2+1) { + for (int i = 2; i * i <= max; i += i % 2 + 1) { if (!is_prime_[i]) continue; // Marks all multiples of i (except i itself) as non-prime. // We are starting here from i-th multiplier, because all smaller // complex numbers were already marked. - for (int j = i*i; j <= max; j += i) { + for (int j = i * i; j <= max; j += i) { is_prime_[j] = false; } } diff --git a/Testing/lib/googletest-master/googletest/samples/sample2.h b/Testing/lib/googletest-master/googletest/samples/sample2.h index e9a5a7050..b6d97461e 100644 --- a/Testing/lib/googletest-master/googletest/samples/sample2.h +++ b/Testing/lib/googletest-master/googletest/samples/sample2.h @@ -34,7 +34,6 @@ #include - // A simple string class. class MyString { private: @@ -77,5 +76,4 @@ class MyString { void Set(const char* c_string); }; - #endif // GTEST_SAMPLES_SAMPLE2_H_ diff --git a/Testing/lib/googletest-master/googletest/samples/sample3-inl.h b/Testing/lib/googletest-master/googletest/samples/sample3-inl.h index 80ba6b923..43c39bc5e 100644 --- a/Testing/lib/googletest-master/googletest/samples/sample3-inl.h +++ b/Testing/lib/googletest-master/googletest/samples/sample3-inl.h @@ -34,7 +34,6 @@ #include - // Queue is a simple queue implemented as a singled-linked list. // // The element type must support copy constructor. @@ -62,7 +61,7 @@ class QueueNode { : element_(an_element), next_(nullptr) {} // We disable the default assignment operator and copy c'tor. - const QueueNode& operator = (const QueueNode&); + const QueueNode& operator=(const QueueNode&); QueueNode(const QueueNode&); E element_; @@ -84,7 +83,7 @@ class Queue { // 1. Deletes every node. QueueNode* node = head_; QueueNode* next = node->next(); - for (; ;) { + for (;;) { delete node; node = next; if (node == nullptr) break; @@ -162,11 +161,11 @@ class Queue { private: QueueNode* head_; // The first node of the queue. QueueNode* last_; // The last node of the queue. - size_t size_; // The number of elements in the queue. + size_t size_; // The number of elements in the queue. // We disallow copying a queue. Queue(const Queue&); - const Queue& operator = (const Queue&); + const Queue& operator=(const Queue&); }; #endif // GTEST_SAMPLES_SAMPLE3_INL_H_ diff --git a/Testing/lib/googletest-master/googletest/src/gtest-internal-inl.h b/Testing/lib/googletest-master/googletest/src/gtest-internal-inl.h index aef5571c1..ca5c8b13a 100644 --- a/Testing/lib/googletest-master/googletest/src/gtest-internal-inl.h +++ b/Testing/lib/googletest-master/googletest/src/gtest-internal-inl.h @@ -35,7 +35,7 @@ #define GTEST_SRC_GTEST_INTERNAL_INL_H_ #ifndef _WIN32_WCE -# include +#include #endif // !_WIN32_WCE #include #include // For strtoll/_strtoul64/malloc/free. @@ -50,16 +50,16 @@ #include "gtest/internal/gtest-port.h" #if GTEST_CAN_STREAM_RESULTS_ -# include // NOLINT -# include // NOLINT +#include // NOLINT +#include // NOLINT #endif #if GTEST_OS_WINDOWS -# include // NOLINT -#endif // GTEST_OS_WINDOWS +#include // NOLINT +#endif // GTEST_OS_WINDOWS -#include "gtest/gtest.h" #include "gtest/gtest-spi.h" +#include "gtest/gtest.h" GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) @@ -125,21 +125,22 @@ GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms); // // On success, stores the value of the flag in *value, and returns // true. On failure, returns false without changing *value. -GTEST_API_ bool ParseInt32Flag( - const char* str, const char* flag, int32_t* value); +GTEST_API_ bool ParseInt32Flag(const char* str, const char* flag, + int32_t* value); // Returns a random seed in range [1, kMaxRandomSeed] based on the // given --gtest_random_seed flag value. inline int GetRandomSeedFromFlag(int32_t random_seed_flag) { - const unsigned int raw_seed = (random_seed_flag == 0) ? - static_cast(GetTimeInMillis()) : - static_cast(random_seed_flag); + const unsigned int raw_seed = + (random_seed_flag == 0) ? static_cast(GetTimeInMillis()) + : static_cast(random_seed_flag); // Normalizes the actual seed to range [1, kMaxRandomSeed] such that // it's easy to type. const int normalized_seed = static_cast((raw_seed - 1U) % - static_cast(kMaxRandomSeed)) + 1; + static_cast(kMaxRandomSeed)) + + 1; return normalized_seed; } @@ -278,8 +279,8 @@ GTEST_API_ int32_t Int32FromEnvOrDie(const char* env_var, int32_t default_val); // returns true if and only if the test should be run on this shard. The test id // is some arbitrary but unique non-negative integer assigned to each test // method. Assumes that 0 <= shard_index < total_shards. -GTEST_API_ bool ShouldRunTestOnShard( - int total_shards, int shard_index, int test_id); +GTEST_API_ bool ShouldRunTestOnShard(int total_shards, int shard_index, + int test_id); // STL container utilities. @@ -291,8 +292,7 @@ inline int CountIf(const Container& c, Predicate predicate) { // Solaris has a non-standard signature. int count = 0; for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) { - if (predicate(*it)) - ++count; + if (predicate(*it)) ++count; } return count; } @@ -399,7 +399,7 @@ class GTEST_API_ UnitTestOptions { // // This recursive algorithm isn't very efficient, but is clear and // works well enough for matching test names, which are short. - static bool PatternMatchesString(const char *pattern, const char *str); + static bool PatternMatchesString(const char* pattern, const char* str); // Returns true if and only if the user-specified filter matches the test // suite name and the test name. @@ -483,7 +483,7 @@ struct TraceInfo { // This is the default global test part result reporter used in UnitTestImpl. // This class should only be used by UnitTestImpl. class DefaultGlobalTestPartResultReporter - : public TestPartResultReporterInterface { + : public TestPartResultReporterInterface { public: explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test); // Implements the TestPartResultReporterInterface. Reports the test part @@ -749,9 +749,7 @@ class GTEST_API_ UnitTestImpl { } // Clears the results of ad-hoc test assertions. - void ClearAdHocTestResult() { - ad_hoc_test_result_.Clear(); - } + void ClearAdHocTestResult() { ad_hoc_test_result_.Clear(); } // Adds a TestProperty to the current TestResult object when invoked in a // context of a test or a test suite, or to the global property set. If the @@ -759,10 +757,7 @@ class GTEST_API_ UnitTestImpl { // updated. void RecordProperty(const TestProperty& test_property); - enum ReactionToSharding { - HONOR_SHARDING_PROTOCOL, - IGNORE_SHARDING_PROTOCOL - }; + enum ReactionToSharding { HONOR_SHARDING_PROTOCOL, IGNORE_SHARDING_PROTOCOL }; // Matches the full name of each test against the user-specified // filter to decide whether the test should run, then records the @@ -991,8 +986,9 @@ GTEST_API_ bool IsValidEscape(char ch); GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch); GTEST_API_ bool ValidateRegex(const char* regex); GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str); -GTEST_API_ bool MatchRepetitionAndRegexAtHead( - bool escaped, char ch, char repeat, const char* regex, const char* str); +GTEST_API_ bool MatchRepetitionAndRegexAtHead(bool escaped, char ch, + char repeat, const char* regex, + const char* str); GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str); #endif // GTEST_USES_SIMPLE_RE @@ -1094,8 +1090,7 @@ class StreamingListener : public EmptyTestEventListener { } ~SocketWriter() override { - if (sockfd_ != -1) - CloseConnection(); + if (sockfd_ != -1) CloseConnection(); } // Sends a string to the socket. @@ -1105,9 +1100,8 @@ class StreamingListener : public EmptyTestEventListener { const auto len = static_cast(message.length()); if (write(sockfd_, message.c_str(), len) != static_cast(len)) { - GTEST_LOG_(WARNING) - << "stream_result_to: failed to stream to " - << host_name_ << ":" << port_num_; + GTEST_LOG_(WARNING) << "stream_result_to: failed to stream to " + << host_name_ << ":" << port_num_; } } @@ -1140,7 +1134,9 @@ class StreamingListener : public EmptyTestEventListener { } explicit StreamingListener(AbstractSocketWriter* socket_writer) - : socket_writer_(socket_writer) { Start(); } + : socket_writer_(socket_writer) { + Start(); + } void OnTestProgramStart(const UnitTest& /* unit_test */) override { SendLn("event=TestProgramStart"); @@ -1163,9 +1159,9 @@ class StreamingListener : public EmptyTestEventListener { void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) override { - SendLn("event=TestIterationEnd&passed=" + - FormatBool(unit_test.Passed()) + "&elapsed_time=" + - StreamableToString(unit_test.elapsed_time()) + "ms"); + SendLn("event=TestIterationEnd&passed=" + FormatBool(unit_test.Passed()) + + "&elapsed_time=" + StreamableToString(unit_test.elapsed_time()) + + "ms"); } // Note that "event=TestCaseStart" is a wire format and has to remain @@ -1188,8 +1184,7 @@ class StreamingListener : public EmptyTestEventListener { void OnTestEnd(const TestInfo& test_info) override { SendLn("event=TestEnd&passed=" + - FormatBool((test_info.result())->Passed()) + - "&elapsed_time=" + + FormatBool((test_info.result())->Passed()) + "&elapsed_time=" + StreamableToString((test_info.result())->elapsed_time()) + "ms"); } diff --git a/Testing/lib/googletest-master/googletest/test/googletest-param-test-test.h b/Testing/lib/googletest-master/googletest/test/googletest-param-test-test.h index 648057017..652df538c 100644 --- a/Testing/lib/googletest-master/googletest/test/googletest-param-test-test.h +++ b/Testing/lib/googletest-master/googletest/test/googletest-param-test-test.h @@ -39,13 +39,11 @@ // Test fixture for testing definition and instantiation of a test // in separate translation units. -class ExternalInstantiationTest : public ::testing::TestWithParam { -}; +class ExternalInstantiationTest : public ::testing::TestWithParam {}; // Test fixture for testing instantiation of a test in multiple // translation units. class InstantiationInMultipleTranslationUnitsTest - : public ::testing::TestWithParam { -}; + : public ::testing::TestWithParam {}; #endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ diff --git a/Testing/lib/googletest-master/googletest/test/gtest-typed-test_test.h b/Testing/lib/googletest-master/googletest/test/gtest-typed-test_test.h index 23137b7ef..120cf229b 100644 --- a/Testing/lib/googletest-master/googletest/test/gtest-typed-test_test.h +++ b/Testing/lib/googletest-master/googletest/test/gtest-typed-test_test.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #ifndef GTEST_TEST_GTEST_TYPED_TEST_TEST_H_ #define GTEST_TEST_GTEST_TYPED_TEST_TEST_H_ @@ -43,22 +42,19 @@ using testing::Test; // and gtest-typed-test2_test.cc. template -class ContainerTest : public Test { -}; +class ContainerTest : public Test {}; TYPED_TEST_SUITE_P(ContainerTest); -TYPED_TEST_P(ContainerTest, CanBeDefaultConstructed) { - TypeParam container; -} +TYPED_TEST_P(ContainerTest, CanBeDefaultConstructed) { TypeParam container; } TYPED_TEST_P(ContainerTest, InitialSizeIsZero) { TypeParam container; EXPECT_EQ(0U, container.size()); } -REGISTER_TYPED_TEST_SUITE_P(ContainerTest, - CanBeDefaultConstructed, InitialSizeIsZero); +REGISTER_TYPED_TEST_SUITE_P(ContainerTest, CanBeDefaultConstructed, + InitialSizeIsZero); #endif // GTEST_HAS_TYPED_TEST_P diff --git a/Testing/lib/googletest-master/googletest/test/production.h b/Testing/lib/googletest-master/googletest/test/production.h index 542723b70..09adb397a 100644 --- a/Testing/lib/googletest-master/googletest/test/production.h +++ b/Testing/lib/googletest-master/googletest/test/production.h @@ -46,6 +46,7 @@ class PrivateCode { PrivateCode(); int x() const { return x_; } + private: void set_x(int an_x) { x_ = an_x; } int x_; diff --git a/ThirdParty/log4cplus-2.0.7/LICENSE.txt b/ThirdParty/log4cplus-2.0.7/LICENSE.txt new file mode 100644 index 000000000..296528596 --- /dev/null +++ b/ThirdParty/log4cplus-2.0.7/LICENSE.txt @@ -0,0 +1,452 @@ +Log4cplus license +================= + +Each file of log4cplus source is licensed using either two clause BSD +license or Apache license 2.0. Log4cplus is derived work from log4j. + +Threadpool code is licensed under separate license. + + +Two clause BSD license +---------------------- + + Copyright © 1999--2009 Contributors to log4cplus project. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modifica tion, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + +Apache 2.0 license +------------------ + + Apache License; Version 2.0, January 2004; http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + +Log4j license +============= + + Apache License; Version 2.0, January 2004; http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + +APPENDIX: How to apply the Apache License to your work +====================================================== + +To apply the Apache License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" replaced +with your own identifying information. (Don't include the brackets!) +The text should be enclosed in the appropriate comment syntax for the +file format. We also recommend that a file or class name and +description of purpose be included on the same "printed page" as the +copyright notice for easier identification within third-party +archives. + + Copyright 1999-2009 [Contributors to log4cplus project] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +Threadpool license +================== + +Copyright (c) 2012-2015 Jakob Progsch + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source + distribution. + +Modified for log4cplus, copyright (c) 2014-2015 Václav Zeman. + diff --git a/ThirdParty/log4cplus-2.0.7/include/log4cplus/config/defines.hxx b/ThirdParty/log4cplus-2.0.7/include/log4cplus/config/defines.hxx index 166396d9c..23ef6bf7f 100644 --- a/ThirdParty/log4cplus-2.0.7/include/log4cplus/config/defines.hxx +++ b/ThirdParty/log4cplus-2.0.7/include/log4cplus/config/defines.hxx @@ -1,4 +1,3 @@ -/* include/log4cplus/config/defines.hxx. Generated from defines.hxx.in by configure. */ #ifndef LOG4CPLUS_CONFIG_DEFINES_HXX #define LOG4CPLUS_CONFIG_DEFINES_HXX @@ -63,7 +62,7 @@ #define LOG4CPLUS_HAVE_WCHAR_H 1 /* */ -/* #undef LOG4CPLUS_HAVE_ICONV_H */ +#define LOG4CPLUS_HAVE_ICONV_H 1 /* */ #define LOG4CPLUS_HAVE_LIMITS_H 1 @@ -234,15 +233,15 @@ /* Define to 1 if the system has the `constructor' function attribute with priority */ -#define LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR_PRIORITY 1 +/* #undef LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR_PRIORITY */ /* Define to 1 if the system has the `constructor' function attribute */ -#define LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR 1 +/* #undef LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR */ /* Define to 1 if the system has the `init_priority' variable attribute */ -#define LOG4CPLUS_HAVE_VAR_ATTRIBUTE_INIT_PRIORITY 1 +/* #undef LOG4CPLUS_HAVE_VAR_ATTRIBUTE_INIT_PRIORITY */ /* Defined to enable unit tests. */ -/* #undef LOG4CPLUS_WITH_UNIT_TESTS */ +#define LOG4CPLUS_WITH_UNIT_TESTS 1 #endif // LOG4CPLUS_CONFIG_DEFINES_HXX diff --git a/ThirdParty/log4cplus-2.0.7/include/log4cplus/config/defines.hxx.cmake b/ThirdParty/log4cplus-2.0.7/include/log4cplus/config/defines.hxx.cmake new file mode 100644 index 000000000..46039e52b --- /dev/null +++ b/ThirdParty/log4cplus-2.0.7/include/log4cplus/config/defines.hxx.cmake @@ -0,0 +1,247 @@ +#ifndef LOG4CPLUS_CONFIG_DEFINES_HXX +#define LOG4CPLUS_CONFIG_DEFINES_HXX + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYSLOG_H @LOG4CPLUS_HAVE_SYSLOG_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_ARPA_INET_H @LOG4CPLUS_HAVE_ARPA_INET_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NETINET_IN_H @LOG4CPLUS_HAVE_NETINET_IN_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NETINET_TCP_H @LOG4CPLUS_HAVE_NETINET_TCP_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_TIMEB_H @LOG4CPLUS_HAVE_SYS_TIMEB_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_TIME_H @LOG4CPLUS_HAVE_SYS_TIME_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_TYPES_H @LOG4CPLUS_HAVE_SYS_TYPES_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_STAT_H @LOG4CPLUS_HAVE_SYS_STAT_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_SYSCALL_H @LOG4CPLUS_HAVE_SYS_SYSCALL_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_FILE_H @LOG4CPLUS_HAVE_SYS_FILE_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_TIME_H @LOG4CPLUS_HAVE_TIME_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_SOCKET_H @LOG4CPLUS_HAVE_SYS_SOCKET_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NETDB_H @LOG4CPLUS_HAVE_NETDB_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_UNISTD_H @LOG4CPLUS_HAVE_UNISTD_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_FCNTL_H @LOG4CPLUS_HAVE_FCNTL_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_STDARG_H @LOG4CPLUS_HAVE_STDARG_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_STDIO_H @LOG4CPLUS_HAVE_STDIO_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_STDLIB_H @LOG4CPLUS_HAVE_STDLIB_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_ERRNO_H @LOG4CPLUS_HAVE_ERRNO_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_WCHAR_H @LOG4CPLUS_HAVE_WCHAR_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_ICONV_H @LOG4CPLUS_HAVE_ICONV_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_LIMITS_H @LOG4CPLUS_HAVE_LIMITS_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_FTIME @LOG4CPLUS_HAVE_FTIME@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GETADDRINFO @LOG4CPLUS_HAVE_GETADDRINFO@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GETHOSTBYNAME_R @LOG4CPLUS_HAVE_GETHOSTBYNAME_R@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GETPID @LOG4CPLUS_HAVE_GETPID@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GMTIME_R @LOG4CPLUS_HAVE_GMTIME_R@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_HTONL @LOG4CPLUS_HAVE_HTONL@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_HTONS @LOG4CPLUS_HAVE_HTONS@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_LOCALTIME_R @LOG4CPLUS_HAVE_LOCALTIME_R@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_LSTAT @LOG4CPLUS_HAVE_LSTAT@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_FCNTL @LOG4CPLUS_HAVE_FCNTL@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_LOCKF @LOG4CPLUS_HAVE_LOCKF@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_FLOCK @LOG4CPLUS_HAVE_FLOCK@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NTOHL @LOG4CPLUS_HAVE_NTOHL@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NTOHS @LOG4CPLUS_HAVE_NTOHS@ + +/* Define to 1 if you have the `shutdown' function. */ +#cmakedefine LOG4CPLUS_HAVE_SHUTDOWN @LOG4CPLUS_HAVE_SHUTDOWN@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_PIPE @LOG4CPLUS_HAVE_PIPE@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_PIPE2 @LOG4CPLUS_HAVE_PIPE2@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_POLL @LOG4CPLUS_HAVE_POLL@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_POLL_H @LOG4CPLUS_HAVE_POLL_H@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_STAT @LOG4CPLUS_HAVE_STAT@ + +/* Define if this is a single-threaded library. */ +#cmakedefine LOG4CPLUS_SINGLE_THREADED @LOG4CPLUS_SINGLE_THREADED@ + +/* */ +#cmakedefine LOG4CPLUS_USE_PTHREADS @LOG4CPLUS_USE_PTHREADS@ + +/* Define for compilers/standard libraries that support more than just the "C" + locale. */ +#cmakedefine LOG4CPLUS_WORKING_LOCALE @LOG4CPLUS_WORKING_LOCALE@ + +/* Define for C99 compilers/standard libraries that support more than just the + "C" locale. */ +#cmakedefine LOG4CPLUS_WORKING_C_LOCALE @LOG4CPLUS_WORKING_C_LOCALE@ + +/* Define to int if undefined. */ +#cmakedefine socklen_t @socklen_t@ + +/* Defined for --enable-debugging builds. */ +#cmakedefine LOG4CPLUS_DEBUGGING @LOG4CPLUS_DEBUGGING@ + +/* Defined if the compiler understands __declspec(dllexport) or + __attribute__((visibility("default"))) construct. */ +#cmakedefine LOG4CPLUS_DECLSPEC_EXPORT @LOG4CPLUS_DECLSPEC_EXPORT@ + +/* Defined if the compiler understands __declspec(dllimport) or + __attribute__((visibility("default"))) construct. */ +#cmakedefine LOG4CPLUS_DECLSPEC_IMPORT @LOG4CPLUS_DECLSPEC_IMPORT@ + +/* Defined if the compiler understands + __attribute__((visibility("hidden"))) construct. */ +#cmakedefine LOG4CPLUS_DECLSPEC_PRIVATE @LOG4CPLUS_DECLSPEC_PRIVATE@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_TLS_SUPPORT @LOG4CPLUS_HAVE_TLS_SUPPORT@ + +/* */ +#cmakedefine LOG4CPLUS_THREAD_LOCAL_VAR @LOG4CPLUS_THREAD_LOCAL_VAR@ + +/* Defined if the host OS provides ENAMETOOLONG errno value. */ +#cmakedefine LOG4CPLUS_HAVE_ENAMETOOLONG @LOG4CPLUS_HAVE_ENAMETOOLONG@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_VSNPRINTF @LOG4CPLUS_HAVE_VSNPRINTF@ + +/* Define to 1 if you have the `vsnwprintf' function. */ +#cmakedefine LOG4CPLUS_HAVE_VSNWPRINTF @LOG4CPLUS_HAVE_VSNWPRINTF@ + +/* Define to 1 if you have the `_vsnwprintf' function. */ +#cmakedefine LOG4CPLUS_HAVE__VSNWPRINTF @LOG4CPLUS_HAVE__VSNWPRINTF@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE__VSNPRINTF @LOG4CPLUS_HAVE__VSNPRINTF@ + +/* Define to 1 if you have the `vfprintf_s' function. */ +#cmakedefine LOG4CPLUS_HAVE_VFPRINTF_S @LOG4CPLUS_HAVE_VFPRINTF_S@ + +/* Define to 1 if you have the `vfwprintf_s' function. */ +#cmakedefine LOG4CPLUS_HAVE_VFWPRINTF_S @LOG4CPLUS_HAVE_VFWPRINTF_S@ + +/* Define to 1 if you have the `vsprintf_s' function. */ +#cmakedefine LOG4CPLUS_HAVE_VSPRINTF_S @LOG4CPLUS_HAVE_VSPRINTF_S@ + +/* Define to 1 if you have the `vswprintf_s' function. */ +#cmakedefine LOG4CPLUS_HAVE_VSWPRINTF_S @LOG4CPLUS_HAVE_VSWPRINTF_S@ + +/* Define to 1 if you have the `_vsnprintf_s' function. */ +#cmakedefine LOG4CPLUS_HAVE__VSNPRINTF_S @LOG4CPLUS_HAVE__VSNPRINTF_S@ + +/* Define to 1 if you have the `_vsnwprintf_s' function. */ +#cmakedefine LOG4CPLUS_HAVE__VSNWPRINTF_S @LOG4CPLUS_HAVE__VSNWPRINTF_S@ + +/* Defined if the compiler supports __FUNCTION__ macro. */ +#cmakedefine LOG4CPLUS_HAVE_FUNCTION_MACRO @LOG4CPLUS_HAVE_FUNCTION_MACRO@ + +/* Defined if the compiler supports __PRETTY_FUNCTION__ macro. */ +#cmakedefine LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO @LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO@ + +/* Defined if the compiler supports __func__ symbol. */ +#cmakedefine LOG4CPLUS_HAVE_FUNC_SYMBOL @LOG4CPLUS_HAVE_FUNC_SYMBOL@ + +/* Define to 1 if you have the `mbstowcs' function. */ +#cmakedefine LOG4CPLUS_HAVE_MBSTOWCS @LOG4CPLUS_HAVE_MBSTOWCS@ + +/* Define to 1 if you have the `wcstombs' function. */ +#cmakedefine LOG4CPLUS_HAVE_WCSTOMBS @LOG4CPLUS_HAVE_WCSTOMBS@ + +/* Define to 1 if you have Linux style syscall(SYS_gettid). */ +#cmakedefine LOG4CPLUS_HAVE_GETTID @LOG4CPLUS_HAVE_GETTID@ + +/* Define when iconv() is available. */ +#cmakedefine LOG4CPLUS_WITH_ICONV @LOG4CPLUS_WITH_ICONV@ + +/* Define to 1 if you have the `iconv' function. */ +#cmakedefine LOG4CPLUS_HAVE_ICONV @LOG4CPLUS_HAVE_ICONV@ + +/* Define to 1 if you have the `iconv_close' function. */ +#cmakedefine LOG4CPLUS_HAVE_ICONV_CLOSE @LOG4CPLUS_HAVE_ICONV_CLOSE@ + +/* Define to 1 if you have the `iconv_open' function. */ +#cmakedefine LOG4CPLUS_HAVE_ICONV_OPEN @LOG4CPLUS_HAVE_ICONV_OPEN@ + +/* Define to 1 if you have the `OutputDebugString' function. */ +#cmakedefine LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING @LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING@ + +/* Define to 1 if the system has the `constructor' function attribute + with priority */ +#cmakedefine LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR_PRIORITY @LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR_PRIORITY@ + +/* Define to 1 if the system has the `constructor' function attribute */ +#cmakedefine LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR @LOG4CPLUS_HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR@ + +/* Define to 1 if the system has the `init_priority' variable attribute */ +#cmakedefine LOG4CPLUS_HAVE_VAR_ATTRIBUTE_INIT_PRIORITY @LOG4CPLUS_HAVE_VAR_ATTRIBUTE_INIT_PRIORITY@ + +/* Defined to enable unit tests. */ +#cmakedefine LOG4CPLUS_WITH_UNIT_TESTS @LOG4CPLUS_WITH_UNIT_TESTS@ + +#endif // LOG4CPLUS_CONFIG_DEFINES_HXX diff --git a/ThirdParty/log4cplus-2.0.7/src/generated/log4cplusConfig.cmake b/ThirdParty/log4cplus-2.0.7/src/generated/log4cplusConfig.cmake new file mode 100644 index 000000000..1f33fac6e --- /dev/null +++ b/ThirdParty/log4cplus-2.0.7/src/generated/log4cplusConfig.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/log4cplusTargets.cmake") diff --git a/ThirdParty/log4cplus-2.0.7/src/generated/log4cplusConfigVersion.cmake b/ThirdParty/log4cplus-2.0.7/src/generated/log4cplusConfigVersion.cmake new file mode 100644 index 000000000..58157e454 --- /dev/null +++ b/ThirdParty/log4cplus-2.0.7/src/generated/log4cplusConfigVersion.cmake @@ -0,0 +1,67 @@ +# This is a basic version file for the Config-mode of find_package(). +# It is used by write_basic_package_version_file() as input file for configure_file() +# to create a version-file which can be installed along a config.cmake file. +# +# The created file sets PACKAGE_VERSION_EXACT if the current version string and +# the requested version string are exactly the same and it sets +# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version, +# but only if the requested major version is the same as the current one. +# The variable CVF_VERSION must be set before calling configure_file(). + + +set(PACKAGE_VERSION "2.0.7") + +if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + + if("2.0.7" MATCHES "^([0-9]+)\\.") + set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}") + else() + set(CVF_VERSION_MAJOR "2.0.7") + endif() + + if(PACKAGE_FIND_VERSION_RANGE) + # both endpoints of the range must have the expected major version + math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1") + if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR + OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR) + OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT))) + set(PACKAGE_VERSION_COMPATIBLE FALSE) + elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR + AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX) + OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX))) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + else() + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + else() + if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + else() + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() + endif() +endif() + + +# if the installed project requested no architecture check, don't perform the check +if("FALSE") + return() +endif() + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") + return() +endif() + +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8") + math(EXPR installedBits "8 * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/config.h b/config.h new file mode 100644 index 000000000..60d066b65 --- /dev/null +++ b/config.h @@ -0,0 +1,6 @@ +#ifndef HAVE_CONFIG_H +#define HAVE_CONFIG_H + +#define GIT_COMMIT_ID "e2ad9d1a614ca1e7da5e4ce3ec2924430eceb3a9" + +#endif