This commit is contained in:
2021-04-25 17:19:49 -05:00
parent 4e17a68e45
commit 45c857508e
13 changed files with 0 additions and 0 deletions

16
cpp/CMakeLists.txt Normal file
View File

@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.0.0)
project(Sandbox VERSION 0.1.0)
include(CTest)
enable_testing()
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
add_executable(testMain src/test.cpp)
target_link_libraries(testMain ${CONAN_LIBS})
add_test(NAME testMain COMMAND testMain)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)

3
cpp/README.md Normal file
View File

@@ -0,0 +1,3 @@
# Sandbox
A sandbox area for learning new things

5
cpp/conanfile.txt Normal file
View File

@@ -0,0 +1,5 @@
[requires]
gtest/1.10.0
[generators]
cmake

1
cpp/requirements.txt Normal file
View File

@@ -0,0 +1 @@
conan

View File

@@ -0,0 +1 @@
-r requirements.txt

10
cpp/src/test001.cpp Normal file
View File

@@ -0,0 +1,10 @@
#include <gtest/gtest.h>
#include <iostream>
TEST(Array, test) {
std::cout << "g" << std::endl;
EXPECT_EQ(1, 1);
}

61
cpp/src/test002.cpp Normal file
View File

@@ -0,0 +1,61 @@
#include <iostream>
using namespace std;
template <typename T>
class TemplateWithWarning {
public:
TemplateWithWarning(uint8_t number) { internalNumber = number; }
TemplateWithWarning(uint8_t number, bool someFlag)
: TemplateWithWarning(number) {}
protected:
uint32_t internalNumber;
};
class ClassWithWarning {
public:
ClassWithWarning(char *name) { this->initClass(name); }
ClassWithWarning(uint8_t blarg) : ClassWithWarning("something") {}
private:
char *name;
void initClass(char *name) { this->name = name; }
};
int main() {
TemplateWithWarning<uint8_t> blarg(5, true);
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;
}
template <typename T>
class A {
virtual void f() {}
public:
virtual ~A() {}
};
template <typename T>
class B : public A<T> {
virtual void f() {}
};
template <typename T>
void waldo() {
return 5;
}
enum class Color { Red, Green };
template <Color COL>
class Test {
public:
// The id could be changed only for red color.
typename std::enable_if<COL == Color::Red>::type setId(int id) { mId = id; }
private:
int mId = 0;
};

63
cpp/src/test003.cpp Normal file
View File

@@ -0,0 +1,63 @@
template <typename T>
class TemplateWithWarning {
public:
TemplateWithWarning(int number) { internalNumber = number; }
TemplateWithWarning(int number, bool someFlag)
: TemplateWithWarning(number) {}
protected:
int internalNumber;
};
class TemplateWithWarning1 {
public:
TemplateWithWarning1(int number) { internalNumber = number; }
TemplateWithWarning1(int number, bool someFlag)
: TemplateWithWarning1(number) {}
protected:
int internalNumber;
};
class ClassWithWarning {
public:
ClassWithWarning(char *n) { this->initClass(n); }
ClassWithWarning(int k) { initClass("hi"); }
private:
char *name;
void initClass(char *name) { this->name = name; }
};
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
IBinding fBinding = null;
if (fNameExp instanceof IASTIdExpression) {
IASTIdExpression fName = (IASTIdExpression)fNameExp;
fBinding = fName.getName().resolveBinding();
} else if (fNameExp instanceof ICPPASTFieldReference) {
ICPPASTFieldReference fName = (ICPPASTFieldReference)fNameExp;
fBinding = fName.getFieldName().resolveBinding();
}
if (fBinding != null) {
// class ClassWithWarning {
// public:
// ClassWithWarning(char* n) {
// this->initClass(n);
// }
//
// private:
// char *name;
// void initClass(char *name) {
// this->name = name;
// }
// };
public
void testMemberFunctionCalling_519473() throws Exception {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
}

22
cpp/vsc.vbs Normal file
View File

@@ -0,0 +1,22 @@
Option Explicit
Dim fsObj
Dim wshShell
Dim scriptDir
Dim strCommand1
Dim strCommand2
Set fsObj = CreateObject("Scripting.FileSystemObject")
Set wshShell = WScript.CreateObject("WScript.Shell")
scriptDir = fsObj.GetParentFolderName(WScript.ScriptFullName)
strCommand1 = Chr(34) & scriptDir & "\.vscode\pyenv.bat" & Chr(34)
strCommand2 = Chr(34) & scriptDir & "\.vscode\vsc.bat" & Chr(34)
' x = msgbox(strCommand1,0, "Launch Command")
' x = msgbox(strCommand2,0, "Launch Command")
Call wshShell.Run(strCommand1, 1, True)
Call wshShell.Run(strCommand2, 0, True)