summaryrefslogtreecommitdiff
path: root/luasnip_snippets/cpp.json
blob: d9b0ba0fb7e65e8f879dbd0b63112bb1429975e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
{
  "main": {
    "prefix": "main",
    "body": [
      "int main(int argc, char *argv[])",
      "{",
      "\t$0",
      "\treturn 0;",
      "\\}"
    ],
    "luasnip": {
      "priority": -49
    }
  },
  "readfile": {
    "prefix": "readfile",
    "description": "read file (readF)",
    "body": [
      "std::vector<char> v;",
      "if (FILE *fp = fopen(${1:\"filename\"}, \"r\"))",
      "{",
      "\tchar buf[1024];",
      "\twhile(size_t len = fread(buf, 1, sizeof(buf), fp))",
      "\t\tv.insert(v.end(), buf, buf + len);",
      "\tfclose(fp);",
      "\\}"
    ]
  },
  "map": {
    "prefix": "map",
    "description": "std::map (map)",
    "body": "std::map<${1:key}, ${2:value}> map$0;"
  },
  "vector": {
    "prefix": "vector",
    "description": "std::vector (v)",
    "body": "std::vector<${1:char}> v$0;"
  },
  "tp": {
    "prefix": "tp",
    "description": "template <typename ..> (template)",
    "body": "template <typename ${1:_InputIter}>"
  },
  "boost_test": {
    "prefix": "boost_test",
    "description": "Boost test module",
    "body": [
      "#define BOOST_TEST_MODULE ${1:TestModuleName}",
      "#include <boost/test/included/unit_test.hpp>",
      "",
      "BOOST_AUTO_TEST_CASE(${2:TestCaseName})",
      "{",
      "\t${0:TestDefinition}",
      "\\}",
      ""
    ]
  },
  "boost_suite": {
    "prefix": "boost_suite",
    "description": "Boost test suite module",
    "body": [
      "#define BOOST_TEST_MODULE ${1:TestModuleName}",
      "#include <boost/test/included/unit_test.hpp>",
      "",
      "BOOST_AUTO_TEST_SUITE(${2:SuiteName})",
      "",
      "BOOST_AUTO_TEST_CASE(${3:TestCaseName})",
      "{",
      "\t${0:TestDefinition}",
      "\\}",
      "",
      "BOOST_AUTO_TEST_SUITE_END()",
      ""
    ]
  },
  "boost_test_fixture": {
    "prefix": "boost_test_fixture",
    "description": "Boost test module with fixture",
    "body": [
      "#define BOOST_TEST_MODULE ${1:TestModuleName}",
      "#include <boost/test/included/unit_test.hpp>",
      "",
      "struct ${2:FixtureName} {",
      "\t$2() {\\}",
      "\tvirtual ~$2() {\\}",
      "\t/* define members here */",
      "\\};",
      "",
      "BOOST_FIXTURE_TEST_CASE(${3:SuiteName}, $2)",
      "{",
      "\t${0:TestDefinition}",
      "\\}",
      ""
    ]
  },
  "boost_suite_fixture": {
    "prefix": "boost_suite_fixture",
    "description": "Boost test suite with fixture",
    "body": [
      "#define BOOST_TEST_MODULE ${1:TestModuleName}",
      "#include <boost/test/included/unit_test.hpp>",
      "",
      "struct ${2:FixtureName} {",
      "\t$2() {\\}",
      "\tvirtual ~$2() {\\}",
      "\t/* define members here */",
      "\\};",
      "",
      "BOOST_FIXTURE_TEST_SUITE(${3:SuiteName}, $2)",
      "",
      "BOOST_AUTO_TEST_CASE(${4:TestCaseName})",
      "{",
      "\t${0:TestDefinition}",
      "\\}",
      "",
      "BOOST_AUTO_TEST_SUITE_END()",
      ""
    ]
  }
}