summaryrefslogtreecommitdiffstats
path: root/test.sh
diff options
context:
space:
mode:
authorWe-unite <3205135446@qq.com>2024-03-07 13:07:59 +0800
committerWe-unite <3205135446@qq.com>2024-03-07 13:19:06 +0800
commit7e85ab6f9e7114ba05264005172e41fb1c47532c (patch)
tree47f530ea33faf42c63b67bc25ac387e54e20b2a6 /test.sh
parent644f678387cd81a87bd0c73ea0123c825bc99e59 (diff)
downloadcalendar-7e85ab6f9e7114ba05264005172e41fb1c47532c.tar.gz
calendar-7e85ab6f9e7114ba05264005172e41fb1c47532c.zip
Change into cmake
Diffstat (limited to '')
-rwxr-xr-xtest.sh37
1 files changed, 0 insertions, 37 deletions
diff --git a/test.sh b/test.sh
deleted file mode 100755
index 645eabe..0000000
--- a/test.sh
+++ /dev/null
@@ -1,37 +0,0 @@
1#!/bin/bash
2
3##########################################################################
4# File Name : test.sh
5# Encoding : utf-8
6# Author : We-unite
7# Email : weunite1848@gmail.com
8# Created Time : 2023-10-06
9##########################################################################
10
11# 如果未出现段错误就重定向输出到res.txt,否则输出到err.txt,并在屏幕上显示出错的年份
12
13# 设置要测试的可执行文件
14executable="main"
15
16echo "" > res.txt
17
18start_time=$(date +%s)
19for year in {1800..2200}; do
20 echo "==================测试年份 $year====================="
21
22 output=$(./$executable "$year" 2>&1)
23
24 exit_code=$?
25 if [ $exit_code -eq 0 ]; then
26 echo -e "$year:\n$output" >> res.txt
27 else
28 # 执行异常,将错误信息重定向到err.txt
29 echo -e "$year:\n$output" >> err.txt
30 echo "执行异常(退出码: $exit_code)"
31 exit 1
32 fi
33done
34end_time=$(date +%s)
35
36echo "测试成功!"
37echo "总用时:$((end_time - start_time))秒"