saqut-compiler/tests/golden/logic/not_operator.sqt

29 lines
671 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ! operatörü golden testi — değişken operandlar (bozuk olan yol).
// Sabit operandlar sabit katlama tarafından derleme zamanında hesaplanır;
// bu test IR üretim yolunu zorlayan değişken operandlar kullanır.
//
// Tanım: !x → sıfırsa 1, değilse 0. Sonuç her zaman 0 ya da 1.
int main() {
int z = 0;
int n = 5;
// Temel: !0 → 1, !5 → 0
print(!z);
print(!n);
// Çift değil normalleştirme: !!5 → 1, !!0 → 0
print(!!n);
print(!!z);
// if (!x) dallanma: z=0 iken gövde çalışmalı, n=5 iken çalışmamalı
if (!z) {
print(1);
}
if (!n) {
print(0);
}
return 0;
}