Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The correctness test of Blue Logger--OMUD
12-20-2017, 06:38 PM (This post was last modified: 12-26-2017 04:40 PM by duke.)
Post: #1
The correctness test of Blue Logger--OMUD
Overview
Currently test_bluelogger is a test program for testing the correctness of Blue Logger. It contains two parts:

1.log_records.cpp: It initializes and gets ready to record the log in "Records.log" which invokes the logging functions created by Blue Logger;

2.test_bluelogger.sh: It aims to judge if "log_records.cpp" can generate the log file in the right location with the right contents.

Maintainer's info

cod://util/bluelogger/src/test_bluelogger/

Users' info

To test the correctness of Blue Logger, run the following code in cod://util/bluelogger/src/

Code:
make test

And it will show "The log location is correct" / "Wrong location!"; "The log contents is correct." / "Wrong contents!".

Designers' info

Pseudocode:

Code:
$myFile = $HOME/Records.log     //$HOME is user's home directory.

$myContents = "Log records function normally"

1.log_records.cpp

Code:
include "blue_logger.h" to invoke the logging functions created by Blue Logger;

call initBlueLog(_T($myFile)) to initialize and get ready to record the log;

call BlueLog::slogA($myContents) to write $myContents;

2.test_bluelogger.sh

Code:
call "make run" to compile "log_records.cpp" and run the file;

if ("$myFile"=="$HOME/Records.log")
    print (The log location is correct.)  
else
    print (Wrong location!)

if ("$myContents"=="Log records function normally")
    print (The log contents is correct.)
else
    print (Wrong contents!)
Find all posts by this user
Quote this message in a reply
12-21-2017, 09:32 AM (This post was last modified: 12-21-2017 09:34 AM by xwcwt.)
Post: #2
RE: test_bluelogger
(12-20-2017 06:38 PM)duke Wrote:  test_bluelogger is a test program for Blue Logger.、

test what? pls state clearly, if it is used for correctness now, just say currently it just test the correctness of Blue Logger.

And pls read after editing. you can find some strange char such as '、'.

Quote:Users' info

test_bluelogger用来测试在调用Blue Logger生成的静态库后,程序能否正确的在指定位置生成相应的日志文件及内容。

Such info can merge into overview.

Quote:$ ./test.sh

After performed, what will the output be like to indicate info/tips?

Quote:
Designers' info

pseudocode.txt:
What's the meaning of pseudocode.txt?

Quote:myPath="<Path>"
myFile="<Path>/test.log"
Here you can say the Path is a parameter or other things get from other place. if not say this, other may not understand

Quote:if ("$myFile"="<Path>/test.log")

I think there should be '==' while not '='. Also I do not see any calling action(call a binary file compiled with Blue Logger static library), then how does the test.log generates?

Please re-organize the info clearly in your mind and carefully reading after edited.


Quote:The code as an example:

Code:
#!/bin/sh                                                                                                                                    

make -f /home/wangyn/forest/util/utilib/test_bluelogger/Makefile

./test

myPath="/home/wangyn/Documents"
myFile="/home/wangyn/Documents/test.log"
myContents="Log records functions normally"

if [ ! -d "$myPath" ]; then
    mkdir "$myPath"
fi

if [ -f "$myFile" ]; then
    echo -e "\033[32m The log location is correct.\033[0m"
    if grep -F "$myContents" "$myFile"; then
        echo -e "\033[32m The log contents is correct.\033[0m"
    else
        echo -e "\033[31m Wrong contents!\033[0m"
    fi
else
    echo -e "\033[31m Wrong location!\033[0m"
fi

Such code is not needed.
Find all posts by this user
Quote this message in a reply
12-21-2017, 03:28 PM
Post: #3
RE: test_bluelogger
(12-21-2017 09:32 AM)xwcwt Wrote:  
(12-20-2017 06:38 PM)duke Wrote:  test_bluelogger is a test program for Blue Logger.、

test what? pls state clearly, if it is used for correctness now, just say currently it just test the correctness of Blue Logger.

And pls read after editing. you can find some strange char such as '、'.

Quote:Users' info

test_bluelogger用来测试在调用Blue Logger生成的静态库后,程序能否正确的在指定位置生成相应的日志文件及内容。

Such info can merge into overview.

Quote:$ ./test.sh

After performed, what will the output be like to indicate info/tips?

Quote:
Designers' info

pseudocode.txt:
What's the meaning of pseudocode.txt?

Quote:myPath="<Path>"
myFile="<Path>/test.log"
Here you can say the Path is a parameter or other things get from other place. if not say this, other may not understand

Quote:if ("$myFile"="<Path>/test.log")

I think there should be '==' while not '='. Also I do not see any calling action(call a binary file compiled with Blue Logger static library), then how does the test.log generates?

Please re-organize the info clearly in your mind and carefully reading after edited.


Quote:The code as an example:

Code:
#!/bin/sh                                                                                                                                    

make -f /home/wangyn/forest/util/utilib/test_bluelogger/Makefile

./test

myPath="/home/wangyn/Documents"
myFile="/home/wangyn/Documents/test.log"
myContents="Log records functions normally"

if [ ! -d "$myPath" ]; then
    mkdir "$myPath"
fi

if [ -f "$myFile" ]; then
    echo -e "\033[32m The log location is correct.\033[0m"
    if grep -F "$myContents" "$myFile"; then
        echo -e "\033[32m The log contents is correct.\033[0m"
    else
        echo -e "\033[31m Wrong contents!\033[0m"
    fi
else
    echo -e "\033[31m Wrong location!\033[0m"
fi

Such code is not needed.

The edition has been updated, pls kindly review it and notice me if there is any mistake. Thx!
Find all posts by this user
Quote this message in a reply
12-22-2017, 03:37 PM
Post: #4
RE: The correctness test of Blue Logger--OMUD
After several on-site talking, I think most info looks acceptable.

Also I suggest you to fix the var '<Path>' to such as '~/'. it can be ensure that the logger program can write sth in that dir. because you are writing test program and currently the dir can be writable is not the critical matter, such 'fix' action is acceptable.

Then you can go ahead first. Be aware that you may need update the design later, ask for review(write a reply) first.
Find all posts by this user
Quote this message in a reply
12-25-2017, 04:10 PM
Post: #5
RE: The correctness test of Blue Logger--OMUD
(12-22-2017 03:37 PM)xwcwt Wrote:  Also I suggest you to fix the var '<Path>' to such as '~/'. it can be ensure that the logger program can write sth in that dir. because you are writing test program and currently the dir can be writable is not the critical matter, such 'fix' action is acceptable.

Understood. The var '<Path>' has been fixed into '~/'

Quote:Then you can go ahead first. Be aware that you may need update the design later, ask for review(write a reply) first.

The desige has been updated, pls review.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: