ClickHouse/tests/queries/0_stateless/00216_bit_test_function_family.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

116 lines
3.3 KiB
MySQL
Raw Normal View History

select
bitTest(0, 0) = 0,
bitTest(1, 0) = 1,
bitTest(1, 1) = 0,
bitTest(0xff, 7) = 1;
select
bitTestAll(0, 0) = 0,
bitTestAll(1, 0) = 1,
bitTestAll(1, 1) = 0,
bitTestAll(0xff, 0) = 1,
bitTestAll(0xff, 1) = 1,
bitTestAll(0xff, 2) = 1,
bitTestAll(0xff, 3) = 1,
bitTestAll(0xff, 4) = 1,
bitTestAll(0xff, 5) = 1,
bitTestAll(0xff, 6) = 1,
bitTestAll(0xff, 7) = 1,
bitTestAll(0xff, 0, 1) = 1,
bitTestAll(0xff, 2, 3) = 1,
bitTestAll(0xff, 4, 5) = 1,
bitTestAll(0xff, 6, 7) = 1,
bitTestAll(0xff, 0, 1, 2, 3) = 1,
bitTestAll(0xff, 4, 5, 6, 7) = 1,
bitTestAll(0xff, 0, 1, 2, 3, 4, 5, 6, 7) = 1,
bitTestAll(0x81, 0) = 1,
bitTestAll(0x81, 1) = 0,
bitTestAll(0x81, 2) = 0,
bitTestAll(0x81, 3) = 0,
bitTestAll(0x81, 4) = 0,
bitTestAll(0x81, 5) = 0,
bitTestAll(0x81, 6) = 0,
bitTestAll(0x81, 7) = 1,
bitTestAll(0x81, 0, 1) = 0,
bitTestAll(0x81, 2, 3) = 0,
bitTestAll(0x81, 4, 5) = 0,
bitTestAll(0x81, 6, 7) = 0,
bitTestAll(0x81, 0, 1, 2, 3) = 0,
bitTestAll(0x81, 4, 5, 6, 7) = 0,
bitTestAll(0x81, 0, 1, 2, 3, 4, 5, 6, 7) = 0,
bitTestAll(0x81, 0, 7) = 1;
select
bitTestAny(0, 0) = 0,
bitTestAny(1, 0) = 1,
bitTestAny(1, 1) = 0,
bitTestAny(0xff, 0) = 1,
bitTestAny(0xff, 1) = 1,
bitTestAny(0xff, 2) = 1,
bitTestAny(0xff, 3) = 1,
bitTestAny(0xff, 4) = 1,
bitTestAny(0xff, 5) = 1,
bitTestAny(0xff, 6) = 1,
bitTestAny(0xff, 7) = 1,
bitTestAny(0xff, 0, 1) = 1,
bitTestAny(0xff, 2, 3) = 1,
bitTestAny(0xff, 4, 5) = 1,
bitTestAny(0xff, 6, 7) = 1,
bitTestAny(0xff, 0, 1, 2, 3) = 1,
bitTestAny(0xff, 4, 5, 6, 7) = 1,
bitTestAny(0xff, 0, 1, 2, 3, 4, 5, 6, 7) = 1,
bitTestAny(0x81, 0) = 1,
bitTestAny(0x81, 1) = 0,
bitTestAny(0x81, 2) = 0,
bitTestAny(0x81, 3) = 0,
bitTestAny(0x81, 4) = 0,
bitTestAny(0x81, 5) = 0,
bitTestAny(0x81, 6) = 0,
bitTestAny(0x81, 7) = 1,
bitTestAny(0x81, 0, 1) = 1,
bitTestAny(0x81, 2, 3) = 0,
bitTestAny(0x81, 4, 5) = 0,
bitTestAny(0x81, 6, 7) = 1,
bitTestAny(0x81, 0, 1, 2, 3) = 1,
bitTestAny(0x81, 4, 5, 6, 7) = 1,
bitTestAny(0x81, 0, 1, 2, 3, 4, 5, 6, 7) = 1;
select n = n_,
number as n,
bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(b7, 1), b6), 1), b5), 1), b4), 1), b3), 1), b2), 1), b1), 1), b0) as n_,
bitTest(n, 7) as b7,
bitTest(n, 6) as b6,
bitTest(n, 5) as b5,
bitTest(n, 4) as b4,
bitTest(n, 3) as b3,
bitTest(n, 2) as b2,
bitTest(n, 1) as b1,
bitTest(n, 0) as b0
from system.numbers limit 256;
select n = n_,
number as n,
bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(b7, 1), b6), 1), b5), 1), b4), 1), b3), 1), b2), 1), b1), 1), b0) as n_,
bitTestAll(n, 7) as b7,
bitTestAll(n, 6) as b6,
bitTestAll(n, 5) as b5,
bitTestAll(n, 4) as b4,
bitTestAll(n, 3) as b3,
bitTestAll(n, 2) as b2,
bitTestAll(n, 1) as b1,
bitTestAll(n, 0) as b0
from system.numbers limit 256;
select n = n_,
number as n,
bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(bitOr(bitShiftLeft(b7, 1), b6), 1), b5), 1), b4), 1), b3), 1), b2), 1), b1), 1), b0) as n_,
bitTestAny(n, 7) as b7,
bitTestAny(n, 6) as b6,
bitTestAny(n, 5) as b5,
bitTestAny(n, 4) as b4,
bitTestAny(n, 3) as b3,
bitTestAny(n, 2) as b2,
bitTestAny(n, 1) as b1,
bitTestAny(n, 0) as b0
from system.numbers limit 256;