File: signed_ints

package info (click to toggle)
bpftrace 0.24.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,496 kB
  • sloc: cpp: 60,982; ansic: 10,952; python: 953; yacc: 665; sh: 536; lex: 295; makefile: 22
file content (36 lines) | stat: -rw-r--r-- 939 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
NAME stats with negative values
PROG begin { @=stats(-10); @=stats(-5); @=stats(5); exit() }
EXPECT @: { .count = 3, .average = -3, .total = -10 }

NAME avg with negative values
PROG begin { @=avg(-30); @=avg(-10);  }
EXPECT @: -20

NAME avg cast negative values
REQUIRES_FEATURE lookup_percpu_elem
PROG begin { @ = avg(-1); @ = avg(-1); @ = avg(-10); if (@ == -4) { printf("done\n");  }}
EXPECT done

NAME negative map value
PROG begin { @ = -11;  }
EXPECT @: -11
TIMEOUT 1

NAME sum negative maps
PROG begin { @ = -11; @+=@; exit() }
EXPECT @: -22
TIMEOUT 1

NAME Comparison should print as 0 or 1
PROG struct x { uint64_t x; }; begin { $a = (*(struct x*)0).x; printf("%d %d\n", $a > -1, $a < 1);  }
EXPECT 0 1
TIMEOUT 1

NAME sum with negative value
PROG begin { @=sum(10); @=sum(-20);  }
EXPECT @: -10
TIMEOUT 1

NAME mixed values
PROG begin { printf("%d %d %d %d\n", (int8) -10, -5555, (int16)-123, 100);  }
EXPECT -10 -5555 -123 100