Skip to content

Commit

Permalink
test gcov1
Browse files Browse the repository at this point in the history
  • Loading branch information
钟楚君 authored and 钟楚君 committed Jul 27, 2020
1 parent 55e6109 commit e16866f
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ language: csharp
install:

- sudo apt-get install nunit
- npm install -g codecov
- sudo apt-get install gcovr

before_script:

- export isTravisTest=true

script:

- make build-and-test
- make build-and-test
- gcc -fprofile-arcs -ftest-coverage -fPIC -O0 FindStackDirection.c -o FindStackDirection
- gcovr -r . --xml
- codecov --disable=gcov



43 changes: 43 additions & 0 deletions FindStackDirection.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include <stdio.h>

// 重定义数据类型
typedef unsigned char UINT8;
typedef signed int INT32;

// 函数声明
void FindStackDirection(void);

INT32 main()
{
FindStackDirection();

return 0;
}

void FindStackDirection(void)
{
UINT8 iStackAddr = 0; // 用于获取栈地址
static UINT8 *pStackAddr = NULL; // 用于存放第一个iStackAddr的地址

if (pStackAddr == NULL) // 第一次进入
{
pStackAddr = &iStackAddr; // 保存iStackAddr的地址
FindStackDirection(); // 递归
}
else // 第二次进入
{
if (&iStackAddr > pStackAddr) // 第二次iStackDirection的地址大于第一次iStackDirection, 那么说明栈增长方向是向上的
{
printf("Stack grows up!\n");
}
else if (&iStackAddr < pStackAddr) // 第二次iStackDirection的地址小于第一次iStackDirection, 那么说明栈增长方向是向下的
{
printf("Stack grows down!\n");
}
else
{
printf("Bad stack!\n");
}
}


3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ build-and-test:

xbuild src/Qiniu.sln

nunit-console bin/QiniuTests.dll
nunit-console bin/QiniuTests.dll

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Qiniu (Cloud) C# SDK

[![LICENSE](https://img.shields.io/github/license/qiniu/csharp-sdk.svg)](https://github.com/qiniu/csharp-sdk/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/qiniu/csharp-sdk.svg?branch=master)](https://travis-ci.org/qiniu/csharp-sdk)
[![GitHub release](https://img.shields.io/github/v/tag/qiniu/csharp-sdk.svg?label=release)](https://github.com/qiniu/csharp-sdk/releases)
[![Coverage Status](https://codecov.io/gh/qiniu/csharp-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/qiniu/csharp-sdk)

## 使用

* 参考文档:[七牛云存储 C# SDK 使用指南](https://developer.qiniu.com/kodo/sdk/1237/csharp)
Expand Down

0 comments on commit e16866f

Please sign in to comment.