Skip to content

Commit

Permalink
Merge pull request #691 from taosdata/feat/math
Browse files Browse the repository at this point in the history
test: move fun to default config
  • Loading branch information
plum-lihui committed Jul 23, 2023
2 parents 561daca + 3506573 commit 738f519
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
21 changes: 19 additions & 2 deletions src/benchCommandOpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,28 @@ static void initStable() {
tstrncpy(c3->name, "phase", TSDB_COL_NAME_LEN + 1);

c1->min = 9;
c1->max = 10;
c1->max = 10;
// fun = "1*sin(x)+10*random(15)"
c1->funType = FUNTYPE_SIN;
c1->multiple = 1;
c1->random = 15;
c1->addend = 10;

c2->min = 110;
c2->max = 119;
// fun = "40*sin(x)+200*random(10)"
c2->funType = FUNTYPE_SIN;
c2->multiple = 40;
c2->random = 10;
c2->addend = 200;

c3->min = 115;
c3->max = 125;
// fun = "1*sin(x)+1*random(3)"
c3->funType = FUNTYPE_SIN;
c3->multiple = 1;
c3->random = 3;
c3->addend = 1;

stbInfo->tags = benchArrayInit(2, sizeof(Field));
for (int i = 0; i < 2; ++i) {
Expand Down Expand Up @@ -349,7 +366,7 @@ void modifyArgument() {

if (g_arguments->demo_mode && TAOSC_IFACE == g_arguments->iface) {
g_arguments->mistMode = true;
g_arguments->prepared_rand = 57;
g_arguments->prepared_rand = 360;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/benchData.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,14 +513,14 @@ static float tmpFloatI(Field *field, int i) {

static int tmpInt32Impl(Field *field, int i, int angle) {
int intTmp;
if ((g_arguments->demo_mode) && (i == 0)) {
if (field->funType != FUNTYPE_NONE) {
// calc from function
intTmp = calc_expr_value(field, angle);
} else if ((g_arguments->demo_mode) && (i == 0)) {
unsigned int tmpRand = taosRandom();
intTmp = tmpRand % 10 + 1;
} else if ((g_arguments->demo_mode) && (i == 1)) {
intTmp = 105 + taosRandom() % 10;
} else if (field->funType != FUNTYPE_NONE) {
// calc from function
intTmp = calc_expr_value(field, angle);
} else {
if (field->min < (-1 * (RAND_MAX >> 1))) {
field->min = -1 * (RAND_MAX >> 1);
Expand Down

0 comments on commit 738f519

Please sign in to comment.