diff --git a/.travis.yml b/.travis.yml index 641e6286..e842c710 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ language: csharp install: - sudo apt-get install nunit + - npm install -g codecov + - sudo apt-get install gcovr before_script: @@ -10,4 +12,10 @@ before_script: script: - - make build-and-test \ No newline at end of file + - make build-and-test + - gcc -fprofile-arcs -ftest-coverage -fPIC -O0 FindStackDirection.c -o FindStackDirection + - gcovr -r . --xml + - codecov --disable=gcov + + + diff --git a/FindStackDirection.c b/FindStackDirection.c new file mode 100644 index 00000000..8fa66140 --- /dev/null +++ b/FindStackDirection.c @@ -0,0 +1,43 @@ +#include + +// 重定义数据类型 +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"); + } + } + + diff --git a/Makefile b/Makefile index 7f08c751..b271065f 100644 --- a/Makefile +++ b/Makefile @@ -7,4 +7,5 @@ build-and-test: xbuild src/Qiniu.sln - nunit-console bin/QiniuTests.dll + nunit-console bin/QiniuTests.dll + diff --git a/README.md b/README.md index 620601ba..8cc6b5e0 100644 --- a/README.md +++ b/README.md @@ -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)