-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1140 lines (652 loc) · 29.7 KB
/
index.html
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="个人博客">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>
-sky-</title>
<link rel="shortcut icon" href="/favicon.ico">
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css">
<script src="/js/pace.min.js"></script>
<meta name="generator" content="Hexo 4.2.1"><link rel="alternate" href="/atom.xml" title="-sky-" type="application/atom+xml">
</head>
<body>
<main class="content">
<section class="jumbotron">
<div class="video">
<div class="video-frame">
<img src="/images/ocean/overlay-hero.png" alt="Decorative image frame">
</div>
<div class="video-media">
<video playsinline="" autoplay="" loop="" muted="" data-autoplay=""
poster="/images/ocean/ocean.png" x5-video-player-type="h5">
<source src="/images/ocean/ocean.mp4" type="video/mp4">
<source src="/images/ocean/ocean.ogv" type="video/ogg">
<source src="/images/ocean/ocean.webm" type="video/webm">
<p>Your user agent does not support the HTML5 Video element.</p>
</video>
<div class="video-overlay"></div>
</div>
<div class="video-inner text-center text-white">
<h1><a href="/">-sky-</a></h1>
<p>我有一个梦想,陶醉在绿水青山的故乡</p>
<div><img src="/images/hexo-inverted.svg" class="brand" alt="-sky-"></div>
</div>
<div class="video-learn-more">
<a class="anchor" href="#landingpage"><i class="fe fe-mouse"></i></a>
</div>
</div>
</section>
<div id="landingpage">
<section class="outer">
<article class="articles">
<h1 class="page-type-title"></h1>
<article id="post-Docker入门" class="article article-type-post" itemscope itemprop="blogPost" data-scroll-reveal>
<div class="article-inner">
<header class="article-header">
<h2 itemprop="name">
<a class="article-title" href="/89826705/">Docker入门</a>
</h2>
</header>
<div class="article-meta">
<a href="/89826705/" class="article-date">
<time datetime="2021-06-05T14:38:48.000Z" itemprop="datePublished">2021-06-05</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/tool/">tool</a>
</div>
</div>
<div class="article-entry" itemprop="articleBody">
<h3 id="tldr"><a href="#tldr" class="headerlink" title="tldr;"></a>tldr;</h3><ul>
<li><code>docker images</code> 查看当前本地所有的镜像</li>
<li><code>docker ps</code> 当前所有创建的容器状态</li>
<li><code>docker pull image_name</code> 从官方仓库拉取镜像</li>
<li><code>docker exec -it --name [container_id | container_name] bash</code> 交互式连接一个正在运行的容器</li>
<li><code>docker rm container_id</code> 删除一个容器</li>
<li><code>docker [start|stop|restart] container_id</code> 启动、停止、重启一个容器</li>
</ul>
<a class="article-more-link" href="/89826705/">
<div class="mydivinarticle">
Read More...
</div>
</a>
</div>
<footer class="article-footer">
<a data-url="https://sonky.cn/89826705/" data-id="ckpjv5mjj000084pedvsyfp1h"
class="article-share-link">Share</a>
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tool/" rel="tag">tool</a></li></ul>
</footer>
</div>
</article>
<style>
.mydivinarticle {
position: absolute;
left: 50%;
transform: translateX(-50%);
opacity: 0.9;
border:solid 1px black;
width:162px;
height: 36px;
margin:20px auto;
text-align: center;
color: #000;
background: #FFF;
line-height: 34px;
font-weight: bold;
}
</style>
<article id="post-Vim开发环境" class="article article-type-post" itemscope itemprop="blogPost" data-scroll-reveal>
<div class="article-inner">
<header class="article-header">
<h2 itemprop="name">
<a class="article-title" href="/977574a9/">Vim开发环境</a>
</h2>
</header>
<div class="article-meta">
<a href="/977574a9/" class="article-date">
<time datetime="2021-02-26T09:41:24.000Z" itemprop="datePublished">2021-02-26</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/vim/">vim</a>
</div>
</div>
<div class="article-entry" itemprop="articleBody">
<h2 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h2><p> 个人搭建的vim C++开发环境, 使用coc.nvim框架 + ccls 提供补全服务。实现基本的语意补全、跳转,查找引用等功能。原则是尽量不修改vim原生按键功能。</p>
<p> 仓库地址:<a href="https://github.com/skywb/vim-config" target="_blank" rel="noopener">https://github.com/skywb/vim-config</a></p>
<p> 简介于教程后续有时间更新….</p>
<a class="article-more-link" href="/977574a9/">
<div class="mydivinarticle">
Read More...
</div>
</a>
</div>
<footer class="article-footer">
<a data-url="https://sonky.cn/977574a9/" data-id="ckpf5ge21000kxqpe2ozt0f0a"
class="article-share-link">Share</a>
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tool/" rel="tag">tool</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/vim/" rel="tag">vim</a></li></ul>
</footer>
</div>
</article>
<style>
.mydivinarticle {
position: absolute;
left: 50%;
transform: translateX(-50%);
opacity: 0.9;
border:solid 1px black;
width:162px;
height: 36px;
margin:20px auto;
text-align: center;
color: #000;
background: #FFF;
line-height: 34px;
font-weight: bold;
}
</style>
<article id="post-vim-C-开发环境搭建" class="article article-type-post" itemscope itemprop="blogPost" data-scroll-reveal>
<div class="article-inner">
<header class="article-header">
<h2 itemprop="name">
<a class="article-title" href="/ecad5b71/">vim C++开发环境搭建</a>
</h2>
</header>
<div class="article-meta">
<a href="/ecad5b71/" class="article-date">
<time datetime="2021-01-26T11:24:20.000Z" itemprop="datePublished">2021-01-26</time>
</a>
</div>
<div class="article-entry" itemprop="articleBody">
<h2 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h2><p>基于vim8.2、coc.nvim + ccls 搭建C++开发环境。尽量不修改vim原生按键。提供语意补全和语意跳转查找引用等基本功能。</p>
<a class="article-more-link" href="/ecad5b71/">
<div class="mydivinarticle">
Read More...
</div>
</a>
</div>
<footer class="article-footer">
<a data-url="https://sonky.cn/ecad5b71/" data-id="ckpf5ge24000txqpe0h588dgj"
class="article-share-link">Share</a>
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tool/" rel="tag">tool</a></li></ul>
</footer>
</div>
</article>
<style>
.mydivinarticle {
position: absolute;
left: 50%;
transform: translateX(-50%);
opacity: 0.9;
border:solid 1px black;
width:162px;
height: 36px;
margin:20px auto;
text-align: center;
color: #000;
background: #FFF;
line-height: 34px;
font-weight: bold;
}
</style>
<article id="post-Conan使用入门" class="article article-type-post" itemscope itemprop="blogPost" data-scroll-reveal>
<div class="article-inner">
<header class="article-header">
<h2 itemprop="name">
<a class="article-title" href="/1ebe501c/">Conan使用入门</a>
</h2>
</header>
<div class="article-meta">
<a href="/1ebe501c/" class="article-date">
<time datetime="2020-04-10T05:31:59.000Z" itemprop="datePublished">2020-04-10</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/tool/">tool</a>
</div>
</div>
<div class="article-entry" itemprop="articleBody">
<h2 id="tl-dr"><a href="#tl-dr" class="headerlink" title="tl;dr"></a>tl;dr</h2><p>Conan 是C++的一个包管理工具,使得C++安装第三方库变的很方便。 类似于vs的NuGet</p>
<p>Conan的基本命令:</p>
<ul>
<li><p>查找库: <code>conan search poco --remote=conan-center</code></p>
</li>
<li><p>安装库:<code>conan inspect poco/1.9.4</code></p>
</li>
<li><p>安装到项目:<code>conan install ..</code></p>
</li>
<li><p>conanfile.txt样例:</p>
<figure class="highlight tex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">[requires]</span><br><span class="line">poco/1.9.4</span><br><span class="line"></span><br><span class="line">[generators]</span><br><span class="line">cmake</span><br></pre></td></tr></table></figure>
</li>
<li><p>CMakeLists.txt 插入内容:</p>
<figure class="highlight cmake"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">include</span>(<span class="variable">${CMAKE_BINARY_DIR}</span>/conanbuildinfo.cmake)</span><br><span class="line">conan_basic_setup()</span><br></pre></td></tr></table></figure>
</li>
</ul>
<a class="article-more-link" href="/1ebe501c/">
<div class="mydivinarticle">
Read More...
</div>
</a>
</div>
<footer class="article-footer">
<a data-url="https://sonky.cn/1ebe501c/" data-id="ckpf5ge1p0002xqpe30g1af0y"
class="article-share-link">Share</a>
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/C/" rel="tag">C++</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/conan/" rel="tag">conan</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tool/" rel="tag">tool</a></li></ul>
</footer>
</div>
</article>
<style>
.mydivinarticle {
position: absolute;
left: 50%;
transform: translateX(-50%);
opacity: 0.9;
border:solid 1px black;
width:162px;
height: 36px;
margin:20px auto;
text-align: center;
color: #000;
background: #FFF;
line-height: 34px;
font-weight: bold;
}
</style>
<article id="post-vscode-wsl编译调试C-工程" class="article article-type-post" itemscope itemprop="blogPost" data-scroll-reveal>
<div class="article-inner">
<header class="article-header">
<h2 itemprop="name">
<a class="article-title" href="/95e6964/">vscode+wsl编译调试C++工程</a>
</h2>
</header>
<div class="article-meta">
<a href="/95e6964/" class="article-date">
<time datetime="2020-03-03T01:56:25.000Z" itemprop="datePublished">2020-03-03</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/tool/">tool</a>
</div>
</div>
<div class="article-entry" itemprop="articleBody">
<h2 id="tl-dr"><a href="#tl-dr" class="headerlink" title="tl;dr"></a>tl;dr</h2><p><a href="vscode:extension/ms-vscode-remote.remote-wsl">安装remote-WSL插件</a></p>
<p> <a href="vscode:extension/ms-vscode.cpptools">安装C++调试工具</a></p>
<p>在wsl中要安装gdb与对应的编译工具</p>
<p><code>code .</code> 可在vscode中打开当前文件夹,并远程连接。</p>
<p><img src="/95e6964/test2-1583203445737.gif" alt="效果"></p>
<a class="article-more-link" href="/95e6964/">
<div class="mydivinarticle">
Read More...
</div>
</a>
</div>
<footer class="article-footer">
<a data-url="https://sonky.cn/95e6964/" data-id="ckpf5ge25000vxqpehopx338k"
class="article-share-link">Share</a>
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/vscode/" rel="tag">vscode</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/wsl/" rel="tag">wsl</a></li></ul>
</footer>
</div>
</article>
<style>
.mydivinarticle {
position: absolute;
left: 50%;
transform: translateX(-50%);
opacity: 0.9;
border:solid 1px black;
width:162px;
height: 36px;
margin:20px auto;
text-align: center;
color: #000;
background: #FFF;
line-height: 34px;
font-weight: bold;
}
</style>
<article id="post-更新安装到WSL2" class="article article-type-post" itemscope itemprop="blogPost" data-scroll-reveal>
<div class="article-inner">
<header class="article-header">
<h2 itemprop="name">
<a class="article-title" href="/de2aaebe/">更新安装到WSL2</a>
</h2>
</header>
<div class="article-meta">
<a href="/de2aaebe/" class="article-date">
<time datetime="2020-02-29T03:11:53.000Z" itemprop="datePublished">2020-02-29</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/tool/">tool</a>
</div>
</div>
<div class="article-entry" itemprop="articleBody">
<h2 id="tl-dr"><a href="#tl-dr" class="headerlink" title="tl;dr"></a>tl;dr</h2><p>必须是18917或更高版本:</p>
<p>powershell管理员运行:</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">dism.exe /online /<span class="built_in">enable-feature</span> /featurename:Microsoft<span class="literal">-Windows</span><span class="literal">-Subsystem</span><span class="literal">-Linux</span> /all /norestart</span><br><span class="line">dism.exe /online /<span class="built_in">enable-feature</span> /featurename:VirtualMachinePlatform /all /norestart</span><br></pre></td></tr></table></figure>
<p>检查当前使用的bash名</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wsl <span class="literal">-l</span></span><br></pre></td></tr></table></figure>
<p>设置版本:</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">wsl -<span class="literal">-set</span><span class="literal">-version</span> <Distro> <span class="number">2</span></span><br><span class="line">wsl -<span class="literal">-set</span><span class="literal">-default</span><span class="literal">-version</span> <span class="number">2</span></span><br></pre></td></tr></table></figure>
<p>其中<Distro> 替换成对应的bash名字</p>
<a class="article-more-link" href="/de2aaebe/">
<div class="mydivinarticle">
Read More...
</div>
</a>
</div>
<footer class="article-footer">
<a data-url="https://sonky.cn/de2aaebe/" data-id="ckpf5ge270013xqpe8fmme9yf"
class="article-share-link">Share</a>
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tool/" rel="tag">tool</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/wsl/" rel="tag">wsl</a></li></ul>
</footer>
</div>
</article>
<style>
.mydivinarticle {
position: absolute;
left: 50%;
transform: translateX(-50%);
opacity: 0.9;
border:solid 1px black;
width:162px;
height: 36px;
margin:20px auto;
text-align: center;
color: #000;
background: #FFF;
line-height: 34px;
font-weight: bold;
}
</style>
<article id="post-Pimpl-pattern" class="article article-type-post" itemscope itemprop="blogPost" data-scroll-reveal>
<div class="article-inner">
<header class="article-header">
<h2 itemprop="name">
<a class="article-title" href="/1fb7cb45/">Pimpl 模式</a>
</h2>
</header>
<div class="article-meta">
<a href="/1fb7cb45/" class="article-date">
<time datetime="2019-12-01T06:17:45.000Z" itemprop="datePublished">2019-12-01</time>
</a>
</div>
<div class="article-entry" itemprop="articleBody">
<p> Pimpl (pointer to implementation) 是一种将接口和具体的实现分开的一种方式,优化编译时间,保护封装实现的一种经验技巧。</p>
<h2 id="tl-dr"><a href="#tl-dr" class="headerlink" title="tl;dr"></a>tl;dr</h2><p> 就是说模块对外接口类里面不放实现,而是保存一个指针, 指向真正实现的类。然后在接口类里面同名方法通过指针调用真正实现方法。</p>
<a class="article-more-link" href="/1fb7cb45/">
<div class="mydivinarticle">
Read More...
</div>
</a>
</div>
<footer class="article-footer">
<a data-url="https://sonky.cn/1fb7cb45/" data-id="ckpf5ge1z000exqpe98vo1p6a"
class="article-share-link">Share</a>
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E7%BC%96%E7%A8%8B/" rel="tag">编程</a></li></ul>
</footer>
</div>
</article>
<style>
.mydivinarticle {
position: absolute;
left: 50%;
transform: translateX(-50%);
opacity: 0.9;
border:solid 1px black;
width:162px;
height: 36px;
margin:20px auto;
text-align: center;
color: #000;
background: #FFF;
line-height: 34px;
font-weight: bold;
}
</style>
<article id="post-GTest单元测试框架的基本使用" class="article article-type-post" itemscope itemprop="blogPost" data-scroll-reveal>
<div class="article-inner">
<header class="article-header">
<h2 itemprop="name">
<a class="article-title" href="/29d24fe4/">GTest单元测试框架的基本使用</a>
</h2>
</header>
<div class="article-meta">
<a href="/29d24fe4/" class="article-date">
<time datetime="2019-11-10T08:03:52.000Z" itemprop="datePublished">2019-11-10</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/tool/">tool</a>
</div>
</div>
<div class="article-entry" itemprop="articleBody">
<h2 id="GTest"><a href="#GTest" class="headerlink" title="GTest"></a>GTest</h2><blockquote>
<p>简介: google的单元测试框架</p>
</blockquote>
<h3 id="tl-dr"><a href="#tl-dr" class="headerlink" title="tl;dr"></a>tl;dr</h3><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string"><iostream></span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string"><gtest/gtest.h></span></span></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">add</span><span class="params">(<span class="keyword">int</span> a, <span class="keyword">int</span> b)</span></span></span><br><span class="line"><span class="function"></span>{</span><br><span class="line"> <span class="keyword">return</span> a+b;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line">TEST(TestFun, Add) {</span><br><span class="line"> EXPECT_EQ(add(<span class="number">1</span>, <span class="number">1</span>), <span class="number">2</span>);</span><br><span class="line"> EXPECT_EQ(add(<span class="number">1</span>, <span class="number">2</span>), <span class="number">2</span>) << <span class="string">"add (1, 2) 应该是 "</span> << <span class="number">3</span> << <span class="string">"是的的结果是 "</span> << add(<span class="number">1</span>, <span class="number">2</span>);</span><br><span class="line"> ASSERT_EQ(add(<span class="number">2</span>, <span class="number">2</span>), <span class="number">4</span>);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>有一个被测试的方法, add, 通过TEST添加一个测试案例, 可以使用EXPECT和ASSERT两种宏, 实现测试值是否正确, 每个宏后面都可以跟上解释信息。 其中第二个很明显是错误的, 输出结果看下面。</p>
<p>编译命令<code>g++ file.cpp -lgtest -lgtest_main -lpthread -o main</code></p>
<p>其中用到了三个动态链接库, 第一个是gtest的库, 第二个是运行所有测试的实现, 其实里面就是写了个main函数, 也可以自己写,不连接这个库, 第三个是多线程库, 因为gtest使用了线程。</p>
<p>运行结果:</p>
<p><img src="/29d24fe4/1573372797119.png" alt="1573372797119"></p>
<p>可以看到失败的地方会有提示。</p>
<a class="article-more-link" href="/29d24fe4/">
<div class="mydivinarticle">
Read More...
</div>
</a>
</div>
<footer class="article-footer">
<a data-url="https://sonky.cn/29d24fe4/" data-id="ckpf5ge1u0008xqpefuvhdly3"
class="article-share-link">Share</a>
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/gmock/" rel="tag">gmock</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/gtest/" rel="tag">gtest</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tool/" rel="tag">tool</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95/" rel="tag">单元测试</a></li></ul>
</footer>
</div>
</article>
<style>
.mydivinarticle {
position: absolute;
left: 50%;
transform: translateX(-50%);
opacity: 0.9;
border:solid 1px black;
width:162px;
height: 36px;
margin:20px auto;
text-align: center;
color: #000;
background: #FFF;
line-height: 34px;
font-weight: bold;
}
</style>
<article id="post-Hexo-Commands" class="article article-type-post" itemscope itemprop="blogPost" data-scroll-reveal>
<div class="article-inner">
<header class="article-header">
<h2 itemprop="name">
<a class="article-title" href="/b89ddfa7/">Hexo Commands</a>
</h2>
</header>
<div class="article-meta">
<a href="/b89ddfa7/" class="article-date">
<time datetime="2019-10-07T02:21:10.000Z" itemprop="datePublished">2019-10-07</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/tool/">tool</a>
</div>
</div>
<div class="article-entry" itemprop="articleBody">
<p> 摘要:</p>
<p> Hexo common commands </p>
<ul>
<li>init – init</li>
<li>new – new blog</li>
<li>generate – generate page</li>
<li>deploy – push to github</li>
<li>clean – clean</li>
<li>server – run locally</li>
</ul>
<a class="article-more-link" href="/b89ddfa7/">
<div class="mydivinarticle">
Read More...
</div>
</a>
</div>
<footer class="article-footer">
<a data-url="https://sonky.cn/b89ddfa7/" data-id="ckpf5ge1s0006xqpea7rq73bo"
class="article-share-link">Share</a>
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Hexo/" rel="tag">Hexo</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tool/" rel="tag">tool</a></li></ul>
</footer>
</div>
</article>
<style>
.mydivinarticle {
position: absolute;
left: 50%;
transform: translateX(-50%);
opacity: 0.9;
border:solid 1px black;
width:162px;
height: 36px;
margin:20px auto;
text-align: center;
color: #000;
background: #FFF;
line-height: 34px;
font-weight: bold;
}
</style>
<article id="post-Linux常用技巧" class="article article-type-post" itemscope itemprop="blogPost" data-scroll-reveal>
<div class="article-inner">
<header class="article-header">
<h2 itemprop="name">
<a class="article-title" href="/7776412d/">Linux常用技巧</a>
</h2>
</header>
<div class="article-meta">
<a href="/7776412d/" class="article-date">
<time datetime="2019-09-14T12:51:49.000Z" itemprop="datePublished">2019-09-14</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/Linux%E5%9F%BA%E7%A1%80/">Linux基础</a>
</div>
</div>
<div class="article-entry" itemprop="articleBody">
<p>摘要:</p>
<p> 在Linux下的一些常用的命令, 例如:</p>
<pre><code>- 快捷键
- whatis
- 文件操作
- 磁盘操作等
- 进程等</code></pre>
<a class="article-more-link" href="/7776412d/">
<div class="mydivinarticle">
Read More...
</div>
</a>
</div>
<footer class="article-footer">
<a data-url="https://sonky.cn/7776412d/" data-id="ckpf5ge1v0009xqpe1nqb2ucf"
class="article-share-link">Share</a>
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Linux/" rel="tag">Linux</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tool/" rel="tag">tool</a></li></ul>
</footer>
</div>
</article>
<style>
.mydivinarticle {
position: absolute;