提交 5ec8a716 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

test scripts to check i118

上级 da190781
......@@ -7,3 +7,4 @@
/conf/
/bin/
/test/ztf/output/
/test/ztf/.idea/
package main
import (
"fmt"
"strconv"
)
func main() {
arrOfArr := [3][]string{}
arrOfArr[0] = []string{"a","b","c","d","e"}
arrOfArr[1] = []string{"1","2"}
arrOfArr[2] = []string{"X","Y","Z"}
indexArr := make([]int, 0)
for _, _ = range arrOfArr {
indexArr = append(indexArr, 0)
}
for i := 0; i < len(arrOfArr); i++ {
loop := 1
for j := i + 1; j < len(arrOfArr); j++ {
loop = loop * len(arrOfArr[j])
}
indexArr[i] = loop
}
for i := 0; i < 100; i ++ {
str := strconv.Itoa(i) + ": "
for j := 0; j < len(arrOfArr); j++ {
child := arrOfArr[j]
mod := indexArr[j]
remainder := i / mod % len(child)
str = str + child[remainder]
}
fmt.Println(str)
//addCur(&indexArr, arrOfArr)
}
}
\ No newline at end of file
package main
import (
fileUtils "github.com/easysoft/zendata/src/utils/file"
httpUtils "github.com/easysoft/zendata/src/utils/http"
"net/url"
)
func main() {
urlStr := httpUtils.GenUrl("10.8.0.134", 8848, "?config=&F=field_common&lines=10")
data := url.Values{}
defaultContent := fileUtils.ReadFile("demo/default.yaml")
configContent := fileUtils.ReadFile("demo/test.yaml")
data.Add("default", defaultContent)
data.Add("config", configContent)
httpUtils.PostForm(urlStr, data)
}
\ No newline at end of file
Version = 1
Language = zh
\ No newline at end of file
>> `%s zendata config %s`
>> `%s zendata config %s`
\ No newline at end of file
>> zendata config
>> zendata config
>> zendata数据
>> zendata数据
\ No newline at end of file
......@@ -9,6 +9,8 @@ pid=0
[group]
>>
>>
>>
>>
[esac]
*/
......@@ -17,8 +19,16 @@ include_once __DIR__ . DIRECTORY_SEPARATOR . '../common/zd.php';
$zd = new zendata();
$zd->changeLang("en");
$output = $zd->cmd("-e");
print(">> $output[0]\n");
$output = $zd->cmd("-example");
print(">> $output[0]\n");
$zd->changeLang("zh");
$output = $zd->cmd("-e");
print(">> $output[0]\n");
$output = $zd->cmd("-example");
print(">> $output[0]\n");
\ No newline at end of file
>> `ZenData is %s`
>> `ZenData is %s`
>> `ZenData is %s`
\ No newline at end of file
>> `ZenData is %s`
>> ZenData是一款
>> ZenData是一款
>> ZenData是一款
\ No newline at end of file
......@@ -10,6 +10,9 @@ pid=0
>>
>>
>>
>>
>>
>>
[esac]
*/
......@@ -18,11 +21,20 @@ include_once __DIR__ . DIRECTORY_SEPARATOR . '../common/zd.php';
$zd = new zendata();
$zd->changeLang("en");
$output = $zd->cmd("");
print(">> $output[0]\n");
$output = $zd->cmd("-h");
print(">> $output[0]\n");
$output = $zd->cmd("-help");
print(">> $output[0]\n");
$zd->changeLang("zh");
$output = $zd->cmd("");
print(">> $output[0]\n");
$output = $zd->cmd("-h");
print(">> $output[0]\n");
$output = $zd->cmd("-help");
print(">> $output[0]\n");
\ No newline at end of file
......@@ -15,9 +15,10 @@ class zendata
$this->workDir = $config['zd']['workDir'];
}
public function cmd($params)
public function create($default, $conf, $lines, $output, $options = array())
{
$cmdStr = sprintf("%s %s", $this->cmdPath, $params);
$cmdStr = sprintf("%s -c %s/%s -n %d -F %s",
$this->cmdPath, $this->workDir, $conf, $lines, $options["fields"]);
print("$cmdStr\n");
$output = [];
......@@ -25,10 +26,13 @@ class zendata
return $output;
}
public function create($default, $conf, $lines, $output, $options = array())
public function parse($config, $input)
{
$cmdStr = sprintf("%s -c %s/%s -n %d -F %s",
$this->cmdPath, $this->workDir, $conf, $lines, $options["fields"]);
}
public function cmd($params)
{
$cmdStr = sprintf("%s %s", $this->cmdPath, $params);
print("$cmdStr\n");
$output = [];
......@@ -36,7 +40,18 @@ class zendata
return $output;
}
public function parse($config, $input)
public function changeLang($lang)
{
$filename = '';
$filename = sprintf("conf/zdata.conf");
$content = file_get_contents($filename);
$fp = fopen($filename, "w");
$content = str_replace("en", $lang, $content);
$content = str_replace("zh", $lang, $content);
fwrite($fp, $content);
fclose($fp);
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册