doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
0da46ecf-d380-4cd0-9b50-875df8980d26
{ "language": "C++" }
```c++ /* * Copyright 2002 California Institute of Technology */ #include "cantera/IdealGasMix.h" #include "cantera/equilibrium.h" #include "cantera/thermo/IdealSolnGasVPSS.h" #include "cantera/thermo/ThermoFactory.h" using namespace std; using namespace Cantera; int main(int argc, char** argv) { #ifdef _MSC_VER ...
```c++ /* * Copyright 2002 California Institute of Technology */ #include "cantera/IdealGasMix.h" #include "cantera/equilibrium.h" #include "cantera/thermo/IdealSolnGasVPSS.h" #include "cantera/thermo/ThermoFactory.h" using namespace std; using namespace Cantera; int main(int argc, char** argv) { #ifdef _MSC_VER ...
53267e09-c83c-441d-8b51-f078f7ac3694
{ "language": "C++" }
```c++ #include <regex> int main() { std::regex r(R"(\s*(SIGNAL|SLOT)\s*\(\s*(.+)\s*\(.*)"); return 0; } ``` Add license to this test file so license checkers don't complain
```c++ /* This file is part of the clang-lazy static checker. Copyright (C) 2015 Sergio Martins <smartins@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the ...
45cf6db5-2a98-475c-a0b8-eba8647c747a
{ "language": "C++" }
```c++ /* * Entry point for the raytracer binary. * Autor: Dino Wernli */ #include <google/protobuf/stubs/common.h> #include <memory> #include "exporter/bmp_exporter.h" #include "proto/configuration.pb.h" #include "renderer/image.h" #include "renderer/renderer.h" #include "scene/camera.h" #include "scene/point_lig...
```c++ /* * Entry point for the raytracer binary. * Autor: Dino Wernli */ #include <google/protobuf/stubs/common.h> #include <memory> #include "exporter/bmp_exporter.h" #include "proto/configuration.pb.h" #include "renderer/image.h" #include "renderer/renderer.h" #include "scene/camera.h" #include "scene/point_lig...
a9348dc9-e973-485c-b149-6c186b305b7b
{ "language": "C++" }
```c++ #include <node.h> #include <v8.h> #include "helpers.h" using namespace v8; using namespace node; namespace node_objc { // Cast a JavaScript "String" to an "NSString" v8::Handle<Value> Cast_NSString (const Arguments& args) { HandleScope scope; String::Utf8Value val(args[0]->ToString()); NSStrin...
```c++ #import <Foundation/Foundation.h> #include <node.h> #include <v8.h> #include "helpers.h" using namespace v8; using namespace node; namespace node_objc { // Cast a JavaScript "String" to an "NSString" v8::Handle<Value> Cast_NSString (const Arguments& args) { HandleScope scope; String::Utf8Value val...
94f5568e-aeac-40f2-96bf-7b09de430199
{ "language": "C++" }
```c++ /* * Copyright 2022 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "experimental/graphite/src/ResourceCache.h" #include "experimental/graphite/src/Resource.h" #include "include/private/SingleOwner.h" namespace skgpu { #defin...
```c++ /* * Copyright 2022 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "experimental/graphite/src/ResourceCache.h" #include "experimental/graphite/src/Resource.h" #include "include/private/SingleOwner.h" namespace skgpu { #defin...
70e2a25f-b02d-413a-98ab-6ce9c6a96e80
{ "language": "C++" }
```c++ #include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } ``` Change UI to dark style
```c++ #include "mainwindow.h" #include <QApplication> #include <QStyleFactory> int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setStyle(QStyleFactory::create("Fusion")); QPalette dark; dark.setColor(QPalette::Window, QColor(53, 53, 53)); dark.setColor(QPalette::WindowText, Qt::white); d...
ea524db0-2afd-439e-9c83-5c4ead15b6c2
{ "language": "C++" }
```c++ #include "utils/connection.h" namespace utils { Connection::Connection(const std::string& host, const std::string& port) : socket(io_service) { tcp::resolver resolver(io_service); tcp::resolver::query query(host, port); boost::asio::connect(socket, resolver.resolve(query)); response_buf.prepare(8192)...
```c++ #include "utils/connection.h" namespace utils { Connection::Connection(const std::string& host, const std::string& port) : socket(io_service) { tcp::resolver resolver(io_service); tcp::resolver::query query(host, port); boost::asio::connect(socket, resolver.resolve(query)); response_buf.prepare(8192)...
6603b55b-163f-488d-aa0d-b26cf2307232
{ "language": "C++" }
```c++ // Test reading of PCH without original input files. // Generate the PCH, removing the original file: // RUN: echo 'struct S{char c; int i; }; void foo() {}' > %t.h // RUN: echo 'template <typename T> void tf() { T::foo(); }' >> %t.h // RUN: echo '#define RETURN return &i' >> %t.h // RUN: %clang_cc1 -x c++ -emi...
```c++ // Test reading of PCH without original input files. // Generate the PCH, removing the original file: // RUN: echo 'struct S{char c; int i; }; void foo() {}' > %t.h // RUN: echo 'template <typename T> void tf() { T::foo(); }' >> %t.h // RUN: echo '#define RETURN return &i' >> %t.h // RUN: %clang_cc1 -x c++ -emi...
7e30782f-7831-4ff2-937e-0d461c4f7e0d
{ "language": "C++" }
```c++ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/metrics/metrics_service.h" #include <string> #include "base/base64.h" #include "testing/gtest/include/gtest/gtest.h...
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <ctype.h> #include <string> #include "chrome/browser/metrics/metrics_service.h" #include "testing/gtest/include/gtest/gtest.h" // E...
426bc48f-811c-40a2-8373-a9c152fcb672
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -std=c++2a %s -verify struct X { void ref() & {} void cref() const& {} }; void test() { X{}.ref(); // expected-error{{cannot initialize object parameter of type 'X' with an expression of type 'X'}} X{}.cref(); // expected-no-error (X{}.*&X::ref)(); // expected-error{{pointer-to-me...
```c++ // RUN: %clang_cc1 -std=c++2a %s -verify struct X { void ref() & {} void cref() const& {} }; void test() { X{}.ref(); // expected-error{{cannot initialize object parameter of type 'X' with an expression of type 'X'}} X{}.cref(); // expected-no-error (X{}.*&X::ref)(); // expected-error-re{{pointer-to...
38544ab6-2a0a-43e8-b2ad-95340fdb8018
{ "language": "C++" }
```c++ #include "Thread/ScopedLock.hh" namespace LilWrapper { ScopedLock::ScopedLock(Mutex *mutex) : _mutex(mutex) { this->_mutex->lock(); } ScopedLock::~ScopedLock() { this->_mutex->unlock(); } } ``` Make sure the Mutex exists before using it.
```c++ #include "Thread/ScopedLock.hh" namespace LilWrapper { ScopedLock::ScopedLock(Mutex *mutex) : _mutex(mutex) { if (this->_mutex) this->_mutex->lock(); } ScopedLock::~ScopedLock() { if (this->_mutex) this->_mutex->unlock(); } } ```
18dc5c01-ba3e-4a7d-b417-191f14c96b72
{ "language": "C++" }
```c++ #include <bits/stdc++.h> #define pb push_back using namespace std; typedef vector <string> vs; int toNum(string a){ stringstream toNum(a); int num; toNum >> num; return num; } vs split(string line, char d){ vector < string > elements; stringstream ss(line); string item; while(getline(ss, item, d)) elemen...
```c++ #include <bits/stdc++.h> #define pb push_back using namespace std; typedef vector <string> vs; int toNum(string a){ stringstream toNum(a); int num; toNum >> num; return num; } string toString(double d){ stringstream ss; ss << fixed << setprecision(10) << fl; string num = ss.str(); return num; } vs spl...
7678acfe-5c2f-4b2e-9e8e-29b414ad105c
{ "language": "C++" }
```c++ /* * The MIT License (MIT) * * Copyright (c) 2017 Nathan Osman * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights ...
```c++ /* * The MIT License (MIT) * * Copyright (c) 2017 Nathan Osman * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights ...
fe8bff2b-e22e-4805-bce8-5552925e6eb6
{ "language": "C++" }
```c++ #include <stdio.h> #include "Halide.h" #define CHECK(f, s32, s64) \ static_assert(offsetof(buffer_t, f) == (sizeof(void*) == 8 ? (s64) : (s32)), #f " is wrong") int main(int argc, char **argv) { CHECK(dev, 0, 0); CHECK(host, 8, 8); CHECK(extent, 12, 16); CHECK(stride, 28, 32); CHECK(m...
```c++ #include <stdio.h> #include "Halide.h" #define CHECK(f, s32, s64) \ static_assert(offsetof(buffer_t, f) == (sizeof(void*) == 8 ? (s64) : (s32)), #f " is wrong") int main(int argc, char **argv) { CHECK(dev, 0, 0); CHECK(host, 8, 8); CHECK(extent, 12, 16); CHECK(stride, 28, 32); CHECK(m...
3febc0fb-d572-42ff-a7ab-54682511632b
{ "language": "C++" }
```c++ #include <ncurses.h> #include "print.hpp" #include "lightsout.hpp" #include "keybindings.hpp" using namespace roadagain; int main() { initscr(); cbreak(); noecho(); curs_set(0); start_color(); init_colors(); board b(5, 5); keybindings k("emacs"); while (!b.is_perfect()){ ...
```c++ #include <ncurses.h> #include <cstring> #include <string> #include "print.hpp" #include "lightsout.hpp" #include "keybindings.hpp" using namespace roadagain; int main(int argc, char** argv) { initscr(); cbreak(); noecho(); curs_set(0); start_color(); init_colors(); std::string key...
6a64e383-7fae-4893-b195-5f53395f60be
{ "language": "C++" }
```c++ // Copyright (c) 2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/system_monitor.h" namespace base { void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) { PowerEvent po...
```c++ // Copyright (c) 2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/system_monitor.h" namespace base { void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) { PowerEvent po...
ccf35e98-56da-4e2f-8072-8a518a54ade9
{ "language": "C++" }
```c++ //////////////////////////////////////////////////////////////////////////////////////////////// /// /// @file /// @author Kuba Sejdak /// @date 17.07.2016 /// /// @copyright This file is a part of cosmos OS. All rights reserved. /// ////////////////////////////////////////////////////////////////////...
```c++ //////////////////////////////////////////////////////////////////////////////////////////////// /// /// @file /// @author Kuba Sejdak /// @date 17.07.2016 /// /// @copyright This file is a part of cosmos OS. All rights reserved. /// ////////////////////////////////////////////////////////////////////...
5755e770-9150-4472-aeca-881ce60c0474
{ "language": "C++" }
```c++ /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 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 l...
```c++ /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 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 l...
c63a8e04-51d2-4d4c-ba26-6f44362c5446
{ "language": "C++" }
```c++ /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 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 l...
```c++ /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 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 l...
a77f576d-a2ba-4df8-8e1e-618c38490d46
{ "language": "C++" }
```c++ #include <string> #include "catch.hpp" #include "Chemharp.hpp" #include "FormatFactory.hpp" #include "Frame.hpp" #include "formats/XYZ.hpp" using namespace harp; // Dummy format clase class DummyFormat : public Format { public: DummyFormat(){} std::string description() const {return "";} REGISTER...
```c++ #include <string> #include "catch.hpp" #include "Chemharp.hpp" #include "FormatFactory.hpp" #include "Error.hpp" #include "formats/XYZ.hpp" #include "Frame.hpp" using namespace harp; // Dummy format clase class DummyFormat : public Format { public: DummyFormat(){} std::string description() const {ret...
9508d98f-120f-43e3-963e-ea142ff05c71
{ "language": "C++" }
```c++ // For now, this is an empty .cc file that only serves to confirm // named_value_vector.h is // a stand-alone header. #include "drake/systems/framework/named_value_vector.h"``` Add newline at end of file.
```c++ // For now, this is an empty .cc file that only serves to confirm // named_value_vector.h is // a stand-alone header. #include "drake/systems/framework/named_value_vector.h" ```
a00a131b-089d-43a3-92c0-c56f11acde0e
{ "language": "C++" }
```c++ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/browser/renderer_host/render_view_host_observer.h" #include "content/browser/renderer_host/render_view_host.h" RenderViewHo...
```c++ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/browser/renderer_host/render_view_host_observer.h" #include "content/browser/renderer_host/render_view_host.h" RenderViewHo...
7d8c2243-c023-4261-9868-80b241bc1202
{ "language": "C++" }
```c++ // Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #include "VerticalBar.h" VerticalBar::VerticalBar(std::wstring bitmapName, int x, int y, int units, bool reversed) : Meter(bitmapName, x, y, units), _pixelsPerUnit(_rect.Height / _units), _r...
```c++ // Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #include "VerticalBar.h" VerticalBar::VerticalBar(std::wstring bitmapName, int x, int y, int units, bool reversed) : Meter(bitmapName, x, y, units), _pixelsPerUnit(_rect.Height / _units), _r...
2ae4de71-d121-4596-89ad-1224e2fe469b
{ "language": "C++" }
```c++ // Copyright (c) 2004-present, Facebook, Inc. // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. #include "ComponentDescriptorRegistry.h" namespace facebook { namespace react { void ComponentDescriptorRegistry::registerComponentDescri...
```c++ // Copyright (c) 2004-present, Facebook, Inc. // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. #include "ComponentDescriptorRegistry.h" namespace facebook { namespace react { void ComponentDescriptorRegistry::registerComponentDescri...
6d43f9fe-7718-4059-8b63-2200183990f0
{ "language": "C++" }
```c++ #include <ionWindow.h> #include <ionGraphics.h> #include <ionGraphicsGL.h> #include <ionScene.h> using namespace ion; using namespace Scene; using namespace Graphics; int main() { //////////////////// // ionEngine Init // //////////////////// Log::AddDefaultOutputs(); SingletonPoint...
```c++ #include <ionWindow.h> #include <ionGraphics.h> #include <ionGraphicsGL.h> #include <ionScene.h> using namespace ion; using namespace Scene; using namespace Graphics; int main() { //////////////////// // ionEngine Init // //////////////////// Log::AddDefaultOutputs(); SingletonPoint...
3d485eb1-fad9-48f9-be3b-0e4e03855c4c
{ "language": "C++" }
```c++ //===-- EmitFunctions.cpp - interface to insert instrumentation --*- C++ -*--=// // // This inserts a global constant table with function pointers all along // //===----------------------------------------------------------------------===// #include "llvm/Transforms/Instrumentation/EmitFunctions.h" #include "ll...
```c++ //===-- EmitFunctions.cpp - interface to insert instrumentation --*- C++ -*--=// // // This inserts a global constant table with function pointers all along // //===----------------------------------------------------------------------===// #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "ll...
2df2b239-a66a-42af-a22b-567e679d98fd
{ "language": "C++" }
```c++ // RUN: clang-cc -fsyntax-only %s template<typename T> class X0 { public: void f(T t); }; template<typename T> void X0<T>::f(T t) { t = 17; } // FIXME: Later, we'll want to write an explicit template // declaration (extern template) for X0<int*>, then try to // call X0<int*>::f. The translation unit shoul...
```c++ // RUN: clang-cc -fsyntax-only %s template<typename T> class X0 { public: void f(T t); struct Inner { void g(T t); }; }; template<typename T> void X0<T>::f(T t) { t = 17; } extern template class X0<int>; extern template class X0<int*>; template<typename T> void X0<T>::Inner::g(T t) { t = 17...
b75d8215-28ee-4570-bd0d-5375d941d2a2
{ "language": "C++" }
```c++ /* * Copyright 2014 The Imaging Source Europe GmbH * * 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 applic...
```c++ /* * Copyright 2014 The Imaging Source Europe GmbH * * 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 applic...
bf1b3bcb-ff33-4c25-8e43-119babac5651
{ "language": "C++" }
```c++ // Copyright eeGeo Ltd (2012-2015), All Rights Reserved #include "PlaceJumpController.h" #include "IPlaceJumpsModel.h" #include "LatLongAltitude.h" #include "Types.h" #include "ICameraTransitionController.h" namespace ExampleApp { namespace PlaceJumps { namespace SdkModel { ...
```c++ // Copyright eeGeo Ltd (2012-2015), All Rights Reserved #include "PlaceJumpController.h" #include "IPlaceJumpsModel.h" #include "LatLongAltitude.h" #include "Types.h" #include "ICameraTransitionController.h" namespace ExampleApp { namespace PlaceJumps { namespace SdkModel { ...
8cfefa17-a78b-4c3a-8d65-3a68cb90b21a
{ "language": "C++" }
```c++ #include "Item.h" using namespace node; using namespace v8; namespace node_iTunes { // Convenience function that takes an iTunesItem instance (or any subclass) // and wraps it up into the proper JS class type, and returns it. // TODO: Implement some kind of Object Cache, so if the same instance is // at...
```c++ #include "Item.h" using namespace node; using namespace v8; namespace node_iTunes { // Convenience function that takes an iTunesItem instance (or any subclass) // and wraps it up into the proper JS class type, and returns it. // TODO: Implement some kind of Object Cache, so if the same instance is // at...
e7ba6558-19cb-4372-8dfd-e9ecc0e40ba7
{ "language": "C++" }
```c++ // This is the starting point // #include <iostream> #include <fstream> #include <sstream> int main() { std::string first_input; std::string second_input; std::cout << "Enter the first string" << std::endl; std::cin >> first_input; std::cout << "Enter the second string" << std::endl; st...
```c++ // This is the starting point // #include <iostream> #include <fstream> #include <sstream> int main(int argc, char * argv[]) { std::cout << "You supplied " << argc << " arguments, which were: " << std::endl; for (size_t i = 0; i < argc; ++i) { std::cout << argv[i] << std::endl; } std::st...
9f4a7f2b-e6ab-410d-b14c-893c42755f24
{ "language": "C++" }
```c++ #include "Game/Game_Result.h" #include <string> #include "Game/Color.h" #include "Utility.h" Game_Result::Game_Result() : victor(NONE), cause() { } Game_Result::Game_Result(Color winner, const std::string& reason) : victor(winner), ...
```c++ #include "Game/Game_Result.h" #include <string> #include "Game/Color.h" #include "Utility.h" Game_Result::Game_Result() : victor(NONE), cause() { } Game_Result::Game_Result(Color winner, const std::string& reason) : victor(winner), ...
5accda30-b6ad-4d99-94d5-56e027a8f3a0
{ "language": "C++" }
```c++ unsigned __int32 Ret_Int(unsigned __int32 argVal){ unsigned __int32 retVal = (unsigned __int32)argVal; return retVal; } unsigned __int32 Ret_Ptr(void *argVal){ unsigned __int32 retVal = (unsigned __int32)argVal; return retVal; } void Set_Val(__int32 *argVal, __int32 val){ *argVal = val;; } void Mul_Val(...
```c++ #if defined(_MSC_VER) #define EXPORT_API extern "C" __declspec(dllexport) #else #define EXPORT_API extern "C" __attribute__((visibility("default"))) #endif EXPORT_API unsigned __int32 Ret_Int(unsigned __int32 argVal){ unsigned __int32 retVal = (unsigned __int32)argVal; return retVal; } EXPORT_API unsigned _...
b28d219d-b3f0-4fa3-9705-9dd135b3ec3d
{ "language": "C++" }
```c++ //===-- ExampleClangProtoFuzzer.cpp - Fuzz Clang --------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--------------------...
```c++ //===-- ExampleClangProtoFuzzer.cpp - Fuzz Clang --------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--------------------...
596f8134-7194-49e3-a1fb-436c810bed5f
{ "language": "C++" }
```c++ #include "gtest/gtest.h" #include "maze.h" #include "mazereader.h" #include "mazeflooder.h" #include "mazepathfinder.h" #include "mazeprinter.h" TEST(PathFinder,test){ MazeResetData(); ReadMAZFile("mazefiles/empty.maz"); FloodMazeClassic(DefaultGoal()); ASSERT_EQ(0xFE,MazeGetWalls(Home())); ...
```c++ #include "gtest/gtest.h" #include "maze.h" #include "mazereader.h" #include "mazeflooder.h" #include "mazepathfinder.h" #include "mazeprinter.h" TEST(PathFinder,test){ MazeResetData(); ReadMAZFile("mazefiles/empty.maz"); FloodMazeClassic(DefaultGoal()); ASSERT_EQ(0xFE,MazeGetWalls(Home())); // ...
f5070f98-e819-4521-8e7f-43e0836bb97d
{ "language": "C++" }
```c++ #include "Timer.h" #define BOOST_TEST_MODULE TimerTest #include <boost/test/unit_test.hpp> #include <string> #include <iostream> #include <unistd.h> BOOST_AUTO_TEST_CASE(timer_basic_test) { Timer timer; const int sleep_time_microsec = 40; // ad-hoc microseconds to pass unit tests. timer.start(); BOOS...
```c++ #include "Timer.h" #define BOOST_TEST_MODULE TimerTest #include <boost/test/unit_test.hpp> #include <string> #include <unistd.h> BOOST_AUTO_TEST_CASE(timer_basic_test) { Timer timer; const int sleep_time_microsec = 40; // ad-hoc microseconds to pass unit tests. timer.start(); BOOST_REQUIRE(timer.is_r...
5e4bd550-d67d-4c1b-b8d6-ada167f465e4
{ "language": "C++" }
```c++ // RUN: %llvmgxx %s -S -o - | not grep llvm.global_ctor struct S { int A[2]; }; int XX = (int)&(((struct S*)0)->A[1]); ``` Make it work on 64-bit systems.
```c++ // RUN: %llvmgxx %s -S -o - | not grep llvm.global_ctor struct S { int A[2]; }; int XX = (int)(long)&(((struct S*)0)->A[1]); ```
7e776d34-832d-4e58-9708-dfbd98495c0a
{ "language": "C++" }
```c++ // http://www.geeksforgeeks.org/pure-virtual-destructor-c/ // 1) C++ Accepts pure virtual destructors, a Base class needs to provide definition for pure // virtual destructor as well because it is being called in reverse order and compiler // looks for its definition // 2) class contains abstract class if it con...
```c++ // http://www.geeksforgeeks.org/pure-virtual-destructor-c/ // 1) C++ Accepts pure virtual destructors, a Base class needs to provide definition for pure // virtual destructor as well because it is being called in reverse order and compiler // looks for its definition // 2) class contains abstract class if it con...
3e569b78-464d-4e4b-b233-ea8e3149aed9
{ "language": "C++" }
```c++ #include "ofMain.h" #include "ofApp.h" #include "ofAppGLFWWindow.h" int main() { ofGLFWWindowSettings settings; settings.width = 1280; settings.height = 720; settings.setPosition(ofVec2f(300,0)); settings.resizable = true; shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings...
```c++ #include "ofMain.h" #include "ofApp.h" #include "ofAppGLFWWindow.h" int main() { ofGLFWWindowSettings settings; settings.width = 1280; settings.height = 720; settings.setPosition(ofVec2f(300,0)); settings.resizable = true; shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings...
e9c6339b-05f2-4662-8d62-6d191257ab70
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // expected-no-diagnostics struct Base { virtual void override(); }; struct S : Base { virtual void final() final; virtual void override() override; }; struct T { // virt-specifier-seq is only valid in member-declarators, and a function definition...
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // expected-no-diagnostics struct Base { virtual void override(); }; struct S : Base { virtual void final() final; virtual void override() override; }; struct T : Base { virtual void override() override { } }; struct override; struct Base2 { v...
5d16c53c-26a9-4daa-8dfc-b0f71ef3f140
{ "language": "C++" }
```c++ /* Author: vpetrigo Task: , . . , 0. . , 0 ( 0 , ). . Sample Input: 1 2 1 2 1 0 Sample Output: 2 */ #include <iostream> using namespace std; int main() { int prev = -1; int cur = -1; bool prev_gr = false; int cnt = 0; while ...
```c++ /* Author: vpetrigo Task: , . . , 0. . , 0 ( 0 , ). . Sample Input: 1 2 1 2 1 0 Sample Output: 2 */ #include <iostream> using namespace std; int main() { int prev = -1; int cur = -1; bool prev_gr = false; int cnt = 0; // Opt...
a556dfa7-6099-4077-a0e7-29c3df9943a2
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -verify %s class X {}; void test() { X x; x.int; // expected-error{{expected unqualified-id}} x.~int(); // expected-error{{expected a class name}} x.operator; // expected-error{{expected a type}} x.operator typedef; // expected-error{{expected a type}} expected-error...
```c++ // RUN: %clang_cc1 -fsyntax-only -verify %s class X {}; void test() { X x; x.int; // expected-error{{expected unqualified-id}} x.~int(); // expected-error{{expected a class name}} x.operator; // expected-error{{expected a type}} x.operator typedef; // expected-error{{expected a type}} expected-error...
3ed8653d-72a0-45dd-8903-45d591a24b08
{ "language": "C++" }
```c++ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ui/aura/toplevel_window_container.h" #include "base/utf_string_conversions.h" #include "ui/aura/toplevel_window_event_filter.h" nam...
```c++ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ui/aura/toplevel_window_container.h" #include "base/utf_string_conversions.h" #include "ui/aura/toplevel_window_event_filter.h" nam...
80f6a3ef-be2d-43b7-842b-fa3f9501dffb
{ "language": "C++" }
```c++ #include "ofMain.h" #include "ofApp.h" int main( ){ ofSetupOpenGL(1024, 768, OF_WINDOW); ofxDatGui::setAssetPath("./"); // this kicks off the running of my app // can be OF_WINDOW or OF_FULLSCREEN // pass in width and height too: ofRunApp(new ofApp()); } ``` Use the data/ directory in...
```c++ #include "ofMain.h" #include "ofApp.h" int main( ){ ofSetupOpenGL(1024, 768, OF_WINDOW); ofSetDataPathRoot("../Resources/data/"); ofxDatGui::setAssetPath("./"); // this kicks off the running of my app // can be OF_WINDOW or OF_FULLSCREEN // pass in width and height too: ofRunApp(ne...
4760a8f7-1cd9-4ada-841f-a323f5f6b324
{ "language": "C++" }
```c++ #include "Config.hpp" #include "Calculator.hpp" Calculator::Calculator() { ready = false; } Calculator::Calculator(int a, int b) { ready = false; create(a, b); } Calculator::~Calculator() { if (valid()) { destroy(); } } bool Calculator::create(int a, int b) { if (valid()...
```c++ #include "Config.hpp" #include "Calculator.hpp" Calculator::Calculator() { ready = false; } Calculator::Calculator(int a, int b) { ready = false; create(a, b); } Calculator::~Calculator() { if (valid()) { destroy(); } } bool Calculator::create(int a, int b) { if (valid()...
c6f58013-a5de-4d3a-b43d-ef908f6cd118
{ "language": "C++" }
```c++ #include <iostream> #include <dns_sd.h> #include <ev++.h> #include "build_version.h" int main(int argc, char *argv[]) { if (2 != argc) { std::cerr << argv[0] << " <announce file>" << std::endl; std::cerr << "Version: " << VERSION << std::endl; return -1; } return 0; } ``` A...
```c++ #include <iostream> #include <dns_sd.h> #include <ev++.h> #include "build_version.h" inline void check_dnsservice_errors(DNSServiceErrorType& e, const std::string& func_name) { std::string error(func_name); error += ": "; switch (e) { case kDNSServiceErr_NoError: return; ...
d3d3ec91-9d6f-4bfb-9978-eecd3dd01923
{ "language": "C++" }
```c++ #include "CanvasView.h" #include <QMouseEvent> CanvasView::CanvasView(QWidget* parent) : QGraphicsView(parent) { } CanvasView::~CanvasView() { } void CanvasView::mouseReleaseEvent(QMouseEvent *event) { QPointF localPos = QGraphicsView::mapToScene(event->pos()); emit signalMouseReleaseEvent(loca...
```c++ #include "CanvasView.h" #include <QMouseEvent> CanvasView::CanvasView(QWidget* parent) : QGraphicsView(parent) { } CanvasView::~CanvasView() { } void CanvasView::mouseReleaseEvent(QMouseEvent *event) { QGraphicsView::mouseReleaseEvent(event); QPointF localPos = QGraphicsView::mapToScene(event-...
1a1f7bbe-0231-45d7-a72a-bc15d13df1c7
{ "language": "C++" }
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Storage) { ASSERT_TRUE(RunExtensionTest("s...
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" // Started failing with r29947. WebKit merge 49961:49992. IN_PROC_BROWSER_TEST_F(DISA...
0164c5c7-06b8-4bfb-abb9-2dd9525b6077
{ "language": "C++" }
```c++ /* $Id$ */ #include <lac/sparse_vanka.templates.h> // explicit instantiations template class SparseVanka<float>; template class SparseVanka<double>; template void SparseVanka<double>::operator () (Vector<float> &dst, const Vector<float> &src) const; template void SparseVanka<double>::operator () ...
```c++ /* $Id$ */ #include <lac/sparse_vanka.templates.h> // explicit instantiations template class SparseVanka<float>; template class SparseVanka<double>; template void SparseVanka<double>::operator () (Vector<float> &dst, const Vector<float> &src) const; template void SparseVanka<double>::operator () ...
3a7a9246-1299-4bd7-9200-647ea9342e22
{ "language": "C++" }
```c++ #include "binarytree.h" #include <iostream> using namespace std; template <class T> void dotPrint(ostream& out, typename BinaryTree<T>::Inspector treeInspector, size_t id) { out << id << "[label=\"" << treeInspector.getData() << "\"];" << endl; if (treeInspector.hasLeft()) { out << id << " -> " << id + 1...
```c++ #include "binarytree.h" #include <iostream> using namespace std; template <class T> void dotPrint(ostream& out, typename BinaryTree<T>::Inspector treeInspector, size_t id) { if (treeInspector.isEmpty()) { out << id << "[label=\"NULL\" shape=point];" << endl; return; } out << id << "[label=\"" << treeI...
bcaa8ad5-e0db-46f6-bc72-86a8f52289f7
{ "language": "C++" }
```c++ #include "TestData.h" TEST(DataObjectTests, ScalarDataObjectHasCorrectProperties) { float scalarValue = 5.0; DataObject five(scalarValue); EXPECT_EQ(five.Dim(), 0); std::vector<int64_t> expectedShape; EXPECT_EQ(five.Shape(), expectedShape); EXPECT_EQ(five.GetKind(), DataKind::SCALAR); } ...
```c++ #include "TestData.h" TEST(DataObjectTests, ScalarDataObjectHasCorrectProperties) { float scalarValue = 5.0; DataObject five(scalarValue); EXPECT_EQ(five.Dim(), 0); std::vector<int64_t> expectedShape; EXPECT_EQ(five.Shape(), expectedShape); EXPECT_EQ(five.GetKind(), DataKind::SCALAR); } ...
7b4777b4-b73e-4669-9e3e-b9f6109975cd
{ "language": "C++" }
```c++ // Copyright (c) 2014-2015 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/ColinH/PEGTL/ #include <pegtl.hh> namespace modulus { template< unsigned M, unsigned R = 0 > struct my_rule { static_assert( M > 1, "Modulus must be greater than 1" ); ...
```c++ // Copyright (c) 2014-2015 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/ColinH/PEGTL/ #include <pegtl.hh> namespace modulus { template< unsigned M, unsigned R = 0 > struct my_rule { using analyze_t = pegtl::analysis::generic< pegtl::analysis::rul...
be317c57-6839-4dd7-a827-95c256461f01
{ "language": "C++" }
```c++ /* This file is part of the Geometry library. Copyright (C) 2010-2013 Benjamin Eikel <benjamin@eikel.org> This library is subject to the terms of the Mozilla Public License, v. 2.0. You should have received a copy of the MPL along with this library; see the file LICENSE. If not, you can obtain one at htt...
```c++ /* This file is part of the Geometry library. Copyright (C) 2010-2013 Benjamin Eikel <benjamin@eikel.org> This library is subject to the terms of the Mozilla Public License, v. 2.0. You should have received a copy of the MPL along with this library; see the file LICENSE. If not, you can obtain one at htt...
bc22daf7-f4c9-4717-822f-d13f9cb3dfd6
{ "language": "C++" }
```c++ #include <stdlib.h> #include <time.h> #include "make_random_data.hpp" int *make_data(const int size) { return make_data(size, RAND_MAX); } int *make_data(const int size, const int max) { srand(time(NULL)); /* Set a seed */ int *data = (int *)malloc(sizeof(int) * size); for(int i = 0; i < size...
```c++ #include <stdlib.h> #include <time.h> #include "make_random_data.hpp" int *make_random_data(const int size) { return make_random_data(size, RAND_MAX); } int *make_random_data(const int size, const int max) { srand(time(NULL)); /* Set a seed */ int *data = (int *)malloc(sizeof(int) * size); fo...
2997ebdc-1ee0-4d9c-b01f-7bccf024e592
{ "language": "C++" }
```c++ // If user provides his own libc functions, ASan doesn't // intercept these functions. // RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O2 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O3 %...
```c++ // If user provides his own libc functions, ASan doesn't // intercept these functions. // RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O2 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O3 %...
46ae9426-7378-4e87-b17e-b6e93c814e34
{ "language": "C++" }
```c++ //! @file test-getusername.cpp //! @author Andrew Schwartzmeyer <andschwa@microsoft.com> //! @brief Unit tests for GetUserName #include <string> #include <vector> #include <unistd.h> #include <gtest/gtest.h> #include <unicode/unistr.h> #include <pwd.h> #include "getusername.h" //! Test fixture for GetUserName ...
```c++ //! @file test-getusername.cpp //! @author Andrew Schwartzmeyer <andschwa@microsoft.com> //! @brief Unit tests for GetUserName #include <string> #include <vector> #include <unistd.h> #include <gtest/gtest.h> #include <unicode/unistr.h> #include <pwd.h> #include "getusername.h" TEST(GetUserName, Success) { ...
b55270b1-a26a-4256-917e-891b580b69f5
{ "language": "C++" }
```c++ #define BOOST_TEST_MODULE Bitcoin Test Suite #include <boost/test/unit_test.hpp> #include "db.h" #include "txdb.h" #include "main.h" #include "wallet.h" CWallet* pwalletMain; CClientUIInterface uiInterface; extern bool fPrintToConsole; extern void noui_connect(); struct TestingSetup { CCoinsViewDB *pcoin...
```c++ #define BOOST_TEST_MODULE Bitcoin Test Suite #include <boost/test/unit_test.hpp> #include "db.h" #include "txdb.h" #include "main.h" #include "wallet.h" CWallet* pwalletMain; CClientUIInterface uiInterface; extern bool fPrintToConsole; extern void noui_connect(); struct TestingSetup { CCoinsViewDB *pcoin...
ef4bd957-4c02-45ef-aaa8-fdaf3e1944f9
{ "language": "C++" }
```c++ #include <TString.h> #include <DBHandler/HeaderFiles/DBHandler.h> #include <JPetManager/JPetManager.h> using namespace std; int main(int argc, char* argv[]) { DB::SERVICES::DBHandler::createDBConnection("../DBConfig/configDB.cfg"); JPetManager& manager = JPetManager::getManager(); manager.parseCmdLine(argc...
```c++ /** * @copyright Copyright 2016 The J-PET Framework Authors. All rights reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may find a copy of the License in the LICENCE file. * * Unless required by applica...
a771e615-4773-464f-9274-617877ff6c00
{ "language": "C++" }
```c++ #include <config/config_class.h> #include <config/config_object.h> #include <config/config_value.h> #include "wanproxy_config_class_interface.h" WANProxyConfigClassInterface wanproxy_config_class_interface; bool WANProxyConfigClassInterface::activate(ConfigObject *) { /* Eventually would like to do something...
```c++ #include <config/config_class.h> #include <config/config_object.h> #include <config/config_value.h> #include "wanproxy_config_class_interface.h" WANProxyConfigClassInterface wanproxy_config_class_interface; bool WANProxyConfigClassInterface::activate(ConfigObject *co) { if (!ConfigClassAddress::activate(co))...
c2e8b3cb-7a67-42d0-b6ab-45b537e2d90f
{ "language": "C++" }
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" // Flaky, http://crbug.com/19866. Please consult phajdan.jr before re-enabling. IN_PR...
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" // Flaky, http://crbug.com/19866. Please consult phajdan.jr before re-enabling. IN_PR...
846d6700-1a94-41c9-86ac-2d41e82c991c
{ "language": "C++" }
```c++ //! \file Article.cpp #include "Article.h" #include <algorithm> #include "WalkerException.h" namespace WikiWalker { size_t Article::countLinks() const { if(!analyzed_ && links_.empty()) { throw WalkerException("Article not analyzed yet!"); } return links_.size(); } Article::Articl...
```c++ //! \file Article.cpp #include "Article.h" #include <algorithm> #include "WalkerException.h" namespace WikiWalker { size_t Article::countLinks() const { if(!analyzed_ && links_.empty()) { throw WalkerException("Article not analyzed yet!"); } return links_.size(); } Article::Articl...
7c744b9b-d264-40e1-86b5-674cbeb04511
{ "language": "C++" }
```c++ // // Copyright(c) 2016-2017 benikabocha. // Distributed under the MIT License (http://opensource.org/licenses/MIT) // #include "Log.h" #include "UnicodeUtil.h" #include <iostream> #if _WIN32 #include <Windows.h> #endif // _WIN32 namespace saba { DefaultSink::DefaultSink() { m_defaultLogger = spdlog::...
```c++ // // Copyright(c) 2016-2017 benikabocha. // Distributed under the MIT License (http://opensource.org/licenses/MIT) // #include "Log.h" #include "UnicodeUtil.h" #include <iostream> #if _WIN32 #include <Windows.h> #endif // _WIN32 namespace saba { DefaultSink::DefaultSink() { m_defaultLogger = spdlog::...
39000956-c4c6-452b-8ea1-fffeb2287f75
{ "language": "C++" }
```c++ /** * @file main.cpp * @author Volodymyr Shymanskyy * @license This project is released under the MIT License (MIT) * @copyright Copyright (c) 2015 Volodymyr Shymanskyy * @date Mar 2015 * @brief */ //#define BLYNK_DEBUG #define BLYNK_PRINT stdout #ifdef RASPBERRY #include <BlynkApiW...
```c++ /** * @file main.cpp * @author Volodymyr Shymanskyy * @license This project is released under the MIT License (MIT) * @copyright Copyright (c) 2015 Volodymyr Shymanskyy * @date Mar 2015 * @brief */ //#define BLYNK_DEBUG #define BLYNK_PRINT stdout #ifdef RASPBERRY #include <BlynkApiW...
7693e999-04a0-4115-95b6-a8a12c166577
{ "language": "C++" }
```c++ /* * main.cc * * Copyright (c) 2015 Masatoshi Hanai * * This software is released under MIT License. * See LICENSE. * */ #include "glog/logging.h" #include "gflags/gflags.h" #include "gtest/gtest.h" #include "leveldb/db.h" #include "leveldb/options.h" /* test files */ #include "medium/com_test.cc" #i...
```c++ /* * main.cc * * Copyright (c) 2015 Masatoshi Hanai * * This software is released under MIT License. * See LICENSE. * */ #include "glog/logging.h" #include "gflags/gflags.h" #include "gtest/gtest.h" #include "leveldb/db.h" #include "leveldb/options.h" /* test files */ #include "medium/com_test.cc" #i...
ead75b7a-ed36-4bb3-8e6a-10e33b69cdf1
{ "language": "C++" }
```c++ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "search_session.h" #include "match_tools.h" #include "match_context.h" namespace proton::matching { SearchSession::SearchSession(const SessionId &id, fastos::TimeStamp time_of_doom, ...
```c++ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "search_session.h" #include "match_tools.h" #include "match_context.h" namespace proton::matching { SearchSession::SearchSession(const SessionId &id, fastos::TimeStamp time_of_doom, ...
37b43b77-f76f-4509-bcd3-8bd4a72e2a4c
{ "language": "C++" }
```c++ #include "BaseString.hpp" // Apparently, strdup isn't a standard function, and isn't in <cstring> char* strdup(const char *s) throw () { auto n = strlen(s); auto d = new char[n + 1]; return static_cast<char*>(memcpy(d, s, n + 1)); } namespace K3 { template<> std::size_t hash_value<K3::base_string>(co...
```c++ #include "BaseString.hpp" // Apparently, strdup isn't a standard function, and isn't in <cstring> char* strdup(const char *s) throw () { if (!s) { return nullptr; } auto n = strlen(s); auto d = new char[n + 1]; return static_cast<char*>(memcpy(d, s, n + 1)); } namespace K3 { template<> std::...
36cb0cc2-08c0-4e78-94ca-7764db46bcc3
{ "language": "C++" }
```c++ // index_queue.cc // Copyright (c) 2014 Jinglei Ren <jinglei@ren.systems> #include "index_queue.h" void IndexQueue::Remove(int i) { assert(i >= 0); const int prev = array_[i].first; const int next = array_[i].second; if (prev == -EINVAL) { assert(Front() == i); SetFront(next); } else { a...
```c++ // index_queue.cc // Copyright (c) 2014 Jinglei Ren <jinglei@ren.systems> #include "index_queue.h" using namespace std; void IndexQueue::Remove(int i) { assert(i >= 0); const int prev = array_[i].first; const int next = array_[i].second; if (prev == -EINVAL) { assert(Front() == i); SetFront(ne...
44401f5b-359a-4328-b44a-e8e77c74e888
{ "language": "C++" }
```c++ #include "gtest/gtest.h" #include "test/support.hpp" namespace fgt { TEST(DirectTree, MatchesDirect) { auto source = load_ascii_test_matrix("X.txt"); auto target = load_ascii_test_matrix("Y.txt"); auto expected = direct(source, target, 0.5); auto actual = direct_tree(source, target, 0.5, 1e-4)...
```c++ #include "gtest/gtest.h" #include "test/support.hpp" namespace fgt { TEST(DirectTree, MatchesDirect) { auto source = load_ascii_test_matrix("X.txt"); auto target = load_ascii_test_matrix("Y.txt"); double bandwidth = 0.5; auto expected = direct(source, target, bandwidth); double epsilon = 1...
0c485035-ae2a-4c6b-8fce-d4c1d66dbb06
{ "language": "C++" }
```c++ #include "gtest/gtest.h" #include "Ant.h" TEST(AntTest, NewAntIsAlive) { Ant a1; EXPECT_EQ(true, a1.isAlive()); } TEST(AntTest, NewAntIsAgeZero) { Ant a1; EXPECT_EQ(0, a1.getAge()); } TEST(AntTest, AntAgesAfterUpdate) { Ant a1; a1.update(); EXPECT_EQ(1, a1.getAge()); } TEST(AntTest, AntDiesAfterMaxAge...
```c++ #include "gtest/gtest.h" #include "Ant.h" TEST(AntTest, NewAntIsAlive) { Ant a1; EXPECT_TRUE(a1.isAlive()); } TEST(AntTest, NewAntIsAgeZero) { Ant a1; EXPECT_EQ(0, a1.getAge()); } TEST(AntTest, AntAgesAfterUpdate) { Ant a1; a1.update(); EXPECT_EQ(1, a1.getAge()); } TEST(AntTest, AntDiesAfterMaxAge) { ...
c2b45d3d-8bfe-4e7e-b988-0edbf4f17586
{ "language": "C++" }
```c++ // An Homage to Vera Molnar's "An Homange to Durer" SquareSize = [[Square Size]] gridHeight = [[Grid Height]] gridWidth = [[Grid Width]] columnCounter = [[shiftCounter]] rowCounter = [[rowCounter]] if(columnCounter < [[gridWidth]]) { drawVeraLines([[columnCounter]], [[rowCounter]]) columnCounter++; } else ...
```c++ // An homage to Vera Molnar's "Hommage a Durer" SquareSize = [[Square Size]] gridHeight = [[Grid Height]] gridWidth = [[Grid Width]] columnCounter = [[shiftCounter]] rowCounter = [[rowCounter]] if(columnCounter < [[gridWidth]]) { drawVeraLines([[columnCounter]], [[rowCounter]]) columnCounter++; } else if (...
03171fca-4076-4eb8-8471-6414d728ca07
{ "language": "C++" }
```c++ #include "TextureAtlas.h" TextureAtlas::TextureAtlas(const std::string& textureFileName) { sf::Image i; if (!i.loadFromFile("Res/Textures/" + textureFileName + ".png")) { throw std::runtime_error("Unable to open image: " + textureFileName); } loadFromImage(i); m_imageSize ...
```c++ #include "TextureAtlas.h" #include <array> TextureAtlas::TextureAtlas(const std::string& textureFileName) { sf::Image i; if (!i.loadFromFile("Res/Textures/" + textureFileName + ".png")) { throw std::runtime_error("Unable to open image: " + textureFileName); } loadFromImage(i); m...
dae3d8c9-f0f1-4caf-a6ab-d19f4f4f268f
{ "language": "C++" }
```c++ #include <QApplication> #include <QDeclarativeView> #include <QUrl> #include <qplatformdefs.h> #include <LunaWebView.h> #if defined(MEEGO_EDITION_HARMATTAN) #include <MDeclarativeCache> #define NEW_QAPPLICATION(x, y) MDeclarativeCache::qApplication((x), (y)) Q_DECL_EXPORT #else #define NEW_QAPP...
```c++ #include <QApplication> #include <QDeclarativeView> #include <QUrl> #include <QScopedPointer> #include <qplatformdefs.h> #include <LunaWebView.h> #if defined(MEEGO_EDITION_HARMATTAN) #include <MDeclarativeCache> #define NEW_QAPPLICATION(x, y) MDeclarativeCache::qApplication((x), (y)) Q_DECL_EXPORT ...
b48a2296-3a04-446a-84d3-37c30d73c20e
{ "language": "C++" }
```c++ // File: btBoostWrapper.cpp #ifndef _btBoostWrapper_cpp #define _btBoostWrapper_cpp #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wreorder" #include <boost/python.hpp> #include <btBoost/btBoostLinearMath.hpp> #include <btBoost/btBoostDynamics.hpp> using namespace boost::p...
```c++ // File: btBoostWrapper.cpp #ifndef _btBoostWrapper_cpp #define _btBoostWrapper_cpp #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wreorder" #include <boost/python.hpp> #include <btBoost/btBoostLinearMath.hpp> #include <btBoost/btBoostDynamics.hpp> #include <btBoost/btBoost...
ff2c7124-8825-42c9-9b7a-32ba65e9978e
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -verify -fsyntax-only -std=c++11 -fms-extensions %s #if !__has_feature(attribute_deprecated_with_replacement) #error "Missing __has_feature" #endif int a1 [[deprecated("warning", "fixit")]]; // expected-error{{'deprecated' attribute takes no more than 1 argument}...
```c++ // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -verify -fsyntax-only -std=c++11 -fms-extensions %s #if !__has_feature(attribute_deprecated_with_replacement) #error "Missing __has_feature" #endif int a1 [[deprecated("warning", "fixit")]]; // expected-warning{{use of the 'deprecated' attribute is a C++14 extens...
6d61f5d6-0eee-4dba-bcfc-1a2ff9ccca2a
{ "language": "C++" }
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/message_loop.h" #include "base/perf_test_suite.h" #include "chrome/common/chrome_paths.cc" int main(int argc, char **argv)...
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/message_loop.h" #include "base/perf_test_suite.h" #include "chrome/common/chrome_paths.cc" int main(int argc, char **argv)...
f202b4e9-93fb-4ffb-a471-0cd6a7287501
{ "language": "C++" }
```c++ //////////////////////////////////////////////////////////////////////////// // // Copyright 2015 Realm Inc. // // 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...
```c++ //////////////////////////////////////////////////////////////////////////// // // Copyright 2015 Realm Inc. // // 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...
bc5fc40b-e351-4377-8ede-dd805dd07493
{ "language": "C++" }
```c++ #include "Thread/Win/MutexImpl.hh" #include "Thread/ThreadException.hh" namespace LilWrapper { MutexImpl::MutexImpl() { InitializeCriticalSection(&this->_mutex); } MutexImpl::~MutexImpl() { DeleteCriticalSection(&this->_mutex); } void MutexImpl::lock() { EnterCriticalSection(&this-...
```c++ #include "Thread/Win/MutexImpl.hh" #include "Thread/ThreadException.hh" namespace LilWrapper { MutexImpl::MutexImpl() { InitializeCriticalSection(&this->_mutex); } MutexImpl::~MutexImpl() { DeleteCriticalSection(&this->_mutex); } void MutexImpl::lock() { EnterCriticalSection(&this-...
656e38b0-7618-4e08-b979-89c408153969
{ "language": "C++" }
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Storage) { ASSERT_TRUE(RunExtensionTest("s...
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" // Started failing with r29947. WebKit merge 49961:49992. IN_PROC_BROWSER_TEST_F(DISA...
b3685475-4f2e-48a8-890f-15d69d0e1c2a
{ "language": "C++" }
```c++ #include "histogram.h" #include <QPainter> #include <QDebug> Histogram::Histogram(QWidget* p) :QWidget(p) { } void Histogram::setData(const QList<QPair<QString,quint32> >& d) { data = d; update(); } typedef QPair<QString, quint32> StringUIntPair; void Histogram::paintEvent(QPaintEvent *) { if (data....
```c++ #include "histogram.h" #include <QPainter> #include <QDebug> Histogram::Histogram(QWidget* p) :QWidget(p) { } void Histogram::setData(const QList<QPair<QString,quint32> >& d) { data = d; update(); } typedef QPair<QString, quint32> StringUIntPair; void Histogram::paintEvent(QPaintEvent *) { if (data....
ea48166f-2165-48aa-b72e-0622d05e0bd5
{ "language": "C++" }
```c++ /* ** Copyright (C) 2012 Aldebaran Robotics ** See COPYING for the license */ #include <iostream> #include <qi/log.hpp> #include <qimessaging/session.hpp> #include <qimessaging/url.hpp> #include "transportserver_p.hpp" #include "transportserverdummy_p.hpp" namespace qi { bool TransportServerDummyPrivate::l...
```c++ /* ** Copyright (C) 2012 Aldebaran Robotics ** See COPYING for the license */ #include <iostream> #include <qi/log.hpp> #include <qimessaging/session.hpp> #include <qimessaging/url.hpp> #include "transportserver_p.hpp" #include "transportserverdummy_p.hpp" namespace qi { bool TransportServerDummyPrivate::l...
4c88f980-00f6-40e6-9098-579b3801e00e
{ "language": "C++" }
```c++ // Test that we do not poison the array cookie if the operator new is defined // inside the class. // RUN: %clangxx_asan %s -o %t && %run %t // // XFAIL: android // XFAIL: armv7l-unknown-linux-gnueabihf #include <new> #include <stdlib.h> #include <stdint.h> #include <stdio.h> #include <assert.h> struct Foo { ...
```c++ // Test that we do not poison the array cookie if the operator new is defined // inside the class. // RUN: %clangxx_asan %s -o %t && %run %t // // XFAIL: arm #include <new> #include <stdlib.h> #include <stdint.h> #include <stdio.h> #include <assert.h> struct Foo { void *operator new(size_t s) { return Allocat...
4cbcc122-1177-4105-899f-6464a32d4608
{ "language": "C++" }
```c++ #include "matcherexception.h" #include "3rd-party/catch.hpp" using namespace newsboat; extern "C" { MatcherErrorFfi rs_get_test_attr_unavail_error(); MatcherErrorFfi rs_get_test_invalid_regex_error(); } TEST_CASE("Can be constructed from Rust error returned over FFI", "[MatcherException]") { SECTION("Att...
```c++ #include "matcherexception.h" #include "3rd-party/catch.hpp" #include <cstring> using namespace newsboat; extern "C" { MatcherErrorFfi rs_get_test_attr_unavail_error(); MatcherErrorFfi rs_get_test_invalid_regex_error(); } TEST_CASE("Can be constructed from Rust error returned over FFI", "[MatcherExceptio...
cd868293-a271-4bac-8a89-a68f1bf01ff4
{ "language": "C++" }
```c++ //===- Darwin/MappedFile.cpp - Darwin MappedFile Implementation -*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file was developed by Reid Spencer and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. // //===-----------...
```c++ //===- Darwin/MappedFile.cpp - Darwin MappedFile Implementation -*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file was developed by Reid Spencer and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. // //===-----------...
6146fa80-bc59-4ec8-8559-09e106fe2bbf
{ "language": "C++" }
```c++ // Check if trailing return types are supported #include <algorithm> #include <vector> void fun() { int val = 0; std::vector<int> v{0, 1, 2, 4, 8}; std::sort(v.begin(), v.end(), [&](int i, int j)->bool{ val++; return i < j && val++ < i; }); } ``` Make independent of initializer list support.
```c++ // Check if trailing return types are supported #include <algorithm> #include <vector> void fun() { int val = 0; std::vector<int> v(5); std::sort(v.begin(), v.end(), [&](int i, int j)->bool{ val++; return i < j && val++ < i; }); } ```
4cc04b4b-d0af-4cb4-874d-2842573ec569
{ "language": "C++" }
```c++ #include "html.h" #include "el_li.h" #include "document.h" litehtml::el_li::el_li(const std::shared_ptr<litehtml::document>& doc) : litehtml::html_tag(doc) { } int litehtml::el_li::render(int x, int y, int max_width, bool second_pass) { if (m_list_style_type >= list_style_type_armenian && !m_index_initialized...
```c++ #include "html.h" #include "el_li.h" #include "document.h" litehtml::el_li::el_li(const std::shared_ptr<litehtml::document>& doc) : litehtml::html_tag(doc) { } int litehtml::el_li::render(int x, int y, int max_width, bool second_pass) { if (m_list_style_type >= list_style_type_armenian && !m_index_initialized...
8294aa1a-21e8-4a0e-963d-81348cf2fca6
{ "language": "C++" }
```c++ // REQUIRES: x86-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -g -fstandalone-debug -S -mllvm -generate-dwarf-pub-sections=Enable %s -o - | FileCheck %s // FIXME: This testcase shouldn't rely on assembly emission. //CHECK: Lpubtypes_begin[[SECNUM:[0-9]:]] //CHECK: .asciz "G" //C...
```c++ // REQUIRES: x86-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -g -fstandalone-debug -S -mllvm -generate-dwarf-pub-sections=Enable %s -o - | FileCheck %s // FIXME: This testcase shouldn't rely on assembly emission. //CHECK: LpubTypes_begin[[SECNUM:[0-9]:]] //CHECK: .asciz "G" //C...
78c7980c-38f7-40da-9023-2c541196b999
{ "language": "C++" }
```c++ #include <iostream> #include <Python.h> #include "character.h" using namespace std; static int error(const std::string & message){ std::cout << message << std::endl; //PyErr_Print(); return -1; } int main(int argc, char ** argv){ if (argc > 1){ Py_Initialize(); /* NO...
```c++ #include <iostream> #include <Python.h> #include "character.h" using namespace std; static int error(const std::string & message){ std::cout << message << std::endl; //PyErr_Print(); return -1; } int main(int argc, char ** argv){ if (argc > 1){ Py_Initialize(); /* NO...
f73f079e-37eb-49be-99b0-cfd9c6c38089
{ "language": "C++" }
```c++ /************************************************************************* * * Copyright 2016 Realm Inc. * * 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.o...
```c++ /************************************************************************* * * Copyright 2016 Realm Inc. * * 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.o...
b60d51e9-af53-4ef5-b76b-ae22a49624ed
{ "language": "C++" }
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "base/rand_util.h" #include "build/build_config.h" #if defin...
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "base/rand_util.h" #include "build/build_config.h" #if defin...
6fda3be4-a9cf-4362-a644-43b42120352a
{ "language": "C++" }
```c++ // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316 // XFAIL: android // // RUN: %clangxx_asan -fsanitize-coverage=func %s -o %t // RUN: rm -rf %T/coverage-maybe-open-file // RUN: mkdir -p %T/coverage-maybe-open-file && cd %T/coverage-maybe-open-file // RUN: %env_asan_opts=coverage=1 %run ...
```c++ // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316 // XFAIL: android // // RUN: %clangxx_asan -fsanitize-coverage=func %s -o %t // RUN: rm -rf %T/coverage-maybe-open-file // RUN: mkdir -p %T/coverage-maybe-open-file && cd %T/coverage-maybe-open-file // RUN: %env_asan_opts=coverage=1 %run ...
dd79fc97-8815-4335-9895-502b95011283
{ "language": "C++" }
```c++ // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: not %run %t 2>&1 | FileCheck %s #include <stdio.h> char bigchunk[1 << 30]; int main() { printf("Hello, world!\n"); scanf("%s", bigchunk); // CHECK-NOT: Hello, world! // CHECK: Shadow memory range interleaves with an existing memory mapping. // CHECK: ASan shadow...
```c++ // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: not %run %t 2>&1 | FileCheck %s #include <stdio.h> char bigchunk[1 << 30]; int main() { printf("Hello, world!\n"); scanf("%s", bigchunk); // CHECK-NOT: Hello, world! // CHECK: Shadow memory range interleaves with an existing memory mapping. // CHECK: ASan shadow...
577734fd-6d84-45ee-83a8-6b907971c101
{ "language": "C++" }
```c++ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "browser/atom_javascript_dialog_manager.h" #include "base/utf_string_conversions.h" namespace atom { void AtomJavaScriptDialogManager::RunBe...
```c++ // Copyright (c) 2013 GitHub, Inc. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "browser/atom_javascript_dialog_manager.h" #include "base/utf_string_conversions.h" namespace atom { void AtomJavaScriptDialogManager::RunBe...
551ba556-8004-4e2f-8541-f8c5f2bc0e8c
{ "language": "C++" }
```c++ #include "game.hpp" #include "window.hpp" #include "clock.hpp" #include "events.hpp" #include <iostream> // "Game" specific data namespace { bool gIsRunning = false; class GameEventEar : public EventEar { public: void onWindowClose() { Game::stop(); } }; GameEventEar gEar; } void Game::run() ...
```c++ #include "game.hpp" #include "window.hpp" #include "clock.hpp" #include "events.hpp" #include <iostream> // "Game" specific data namespace { bool gIsRunning = false; class GameEventEar : public EventEar { public: void onWindowClose() { Game::stop(); } }; GameEventEar gEar; } void Game::run() ...
f114e5ab-f10d-45d6-b994-17fb23ab27b8
{ "language": "C++" }
```c++ #include <nan.h> #include "input.h" #include "output.h" Nan::Persistent<v8::FunctionTemplate> NodeMidiInput::s_ct; Nan::Persistent<v8::FunctionTemplate> NodeMidiOutput::s_ct; extern "C" { void init (v8::Local<v8::Object> target) { NodeMidiOutput::Init(target); NodeMidiInput::Init(targe...
```c++ #include <nan.h> #include "input.h" #include "output.h" Nan::Persistent<v8::FunctionTemplate> NodeMidiInput::s_ct; Nan::Persistent<v8::FunctionTemplate> NodeMidiOutput::s_ct; NAN_MODULE_INIT(InitAll) { NodeMidiOutput::Init(target); NodeMidiInput::Init(target); } NODE_MODULE(midi, InitAll) ```
7922f945-e1a7-4142-b916-35ec1c682387
{ "language": "C++" }
```c++ #include <iostream> #include <vector> #include "MuMaterial.h" #include "rhythm.hpp" using namespace std; void PrintVector (vector<float> v, string message); int main () { MuInit(); Rhythm rhythm(4, 4, 60); rhythm.GenerateBaseRhythm(2); vector<float> base_rhythm = rhythm.base_rhythm; Pr...
```c++ #include <iostream> #include <vector> #include "MuMaterial.h" #include "rhythm.hpp" using namespace std; void PrintVector (auto const v, string message); int main () { MuInit(); Rhythm rhythm(4, 4, 60); rhythm.GenerateBaseRhythm(2); vector<float> base_rhythm = rhythm.base_rhythm; Print...
fc1f954b-459c-462e-b591-886720f40ac6
{ "language": "C++" }
```c++ // Function grapher: user can choose among a set of functions (e.g., sin() and // log(), provide parameters for those functions and then graph them #include "Simple_window.h" #include "Graph.h" int main() try { Point tl(400,150); Fgraph_window fwin(tl,800,605,"Function Grapher"); return gui_main();...
```c++ // Chapter 16, exercise 10: function grapher: user can choose among a set of // functions (e.g., sin() and log(), provide parameters for those functions and // then graph them #include "Simple_window.h" #include "Graph.h" int main() try { Point tl(400,150); Fgraph_window fwin(tl,800,605,"Function Graph...
75f95e1c-6992-4812-9023-74a38f613d32
{ "language": "C++" }
```c++ // // Parser.cpp // snowcrash // // Created by Zdenek Nemec on 4/8/13. // Copyright (c) 2013 Apiary.io. All rights reserved. // #include <exception> #include <sstream> #include "Parser.h" #include "MarkdownParser.h" #include "BlueprintParser.h" using namespace snowcrash; const int SourceAnnotation::OK; v...
```c++ // // Parser.cpp // snowcrash // // Created by Zdenek Nemec on 4/8/13. // Copyright (c) 2013 Apiary.io. All rights reserved. // #include <exception> #include <sstream> #include "Parser.h" #include "MarkdownParser.h" #include "BlueprintParser.h" using namespace snowcrash; const int SourceAnnotation::OK; /...
ef878749-c569-476d-a8d8-d39454f0510c
{ "language": "C++" }
```c++ #include <QApplication> #include "qkeymapper.h" #ifdef DEBUG_LOGOUT_ON //#include "vld.h" #endif int main(int argc, char *argv[]) { #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif QApplication a(argc, argv); QApplication::setStyle(Q...
```c++ #include <QApplication> #include "qkeymapper.h" #ifdef DEBUG_LOGOUT_ON //#include "vld.h" #endif int main(int argc, char *argv[]) { #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif QApplication a(argc, argv); QApplication::setStyle(QS...
d2e898a3-a8ef-4e9c-a0bb-2408b3b67869
{ "language": "C++" }
```c++ #include "SuffixTree\SuffixTreeBuilder.h" #include <iostream> #include <string> #include <cassert> #include <ctime> using namespace std; int main() { unsigned int length = 100000; char* source = new char[length + 1]; for (unsigned int i = 0; i < length; i++) { source[i] = rand() % 26 + '...
```c++ #include "SuffixTree/SuffixTreeBuilder.h" #include <iostream> #include <string> #include <cassert> #include <ctime> using namespace std; int main() { unsigned int length = 100000; char* source = new char[length + 1]; for (unsigned int i = 0; i < length; i++) { source[i] = rand() % 26 + '...
334f54fe-dfde-49fe-8ad9-59eb1bc09879
{ "language": "C++" }
```c++ #include "glTFForUE4EdPrivatePCH.h" #include "glTFImportOptions.h" FglTFImportOptions::FglTFImportOptions() : FilePathInOS(TEXT("")) , FilePathInEngine(TEXT("")) , MeshScaleRatio(1.0f) , bInvertNormal(false) , bImportMaterial(true) , bRecomputeNormals(true) , bRecomputeTangents(true)...
```c++ #include "glTFForUE4EdPrivatePCH.h" #include "glTFImportOptions.h" FglTFImportOptions::FglTFImportOptions() : FilePathInOS(TEXT("")) , FilePathInEngine(TEXT("")) , MeshScaleRatio(100.0f) , bInvertNormal(false) , bImportMaterial(true) , bRecomputeNormals(true) , bRecomputeTangents(tru...