-
-
Notifications
You must be signed in to change notification settings - Fork 594
/
testprofile.d
109 lines (88 loc) · 1.45 KB
/
testprofile.d
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// REQUIRED_ARGS: -profile
/**
GDB_SCRIPT:
---
r
echo EXIT_CODE :=
print $_exitcode
---
GDB_MATCH: EXIT_CODE :=\$1 = 0
**/
module testprofile;
// ------------------
struct FourUShort {
this(ushort a, ushort b, ushort c, ushort d) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
}
ushort a, b, c, d;
}
void test1()
{
auto f = FourUShort(0, 1, 2, 3);
assert(f.a == 0);
assert(f.b == 1);
assert(f.c == 2);
assert(f.d == 3);
}
// ------------------
void foo5689(double a, double b)
{
assert(a == 17.0);
assert(b == 12.0);
}
__gshared fun5689 = &foo5689;
void test5689()
{
fun5689(17.0, 12.0);
}
// ------------------
class Foo10617
{
void foo() nothrow pure @safe
in { }
out { }
do { }
}
// ------------------
class C10953
{
void func() nothrow pure @safe
in {} out {} do {}
}
class D10953 : C10953
{
override void func() // inherits attributes of Foo.func
in {} out {} do {}
}
// ------------------
void test13331() {asm {naked; ret;}}
// ------------------
// https://issues.dlang.org/show_bug.cgi?id=15745
ubyte LS1B(uint board)
{
asm
{
bsf EAX, board;
}
}
void test15754()
{
for (int i = 0; i < 31; ++i)
{
auto slide = (1U << i);
auto ls1b = slide.LS1B;
assert(ls1b == i);
}
}
// ------------------
int main()
{
test1();
test5689();
test13331();
test15754();
return 0;
}