- 1
#define BSWAP16(x) ( (uint16_t)(((uint32_t)x)*(1 | 1 << 16) >> 8) )
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 331
+1
#define BSWAP16(x) ( (uint16_t)(((uint32_t)x)*(1 | 1 << 16) >> 8) )
+1
// http://pacipfs2.antizapret.prostovpn.org/proxy-ssl.js
function FindProxyForURL(url, host) {
if (d_ipaddr.length < 10) return "DIRECT"; // list is broken
if (!az_initialized) {
var prev_ipval = 0;
for (var i = 0; i < d_ipaddr.length; i++) {
d_ipaddr[i] = parseInt(d_ipaddr[i], 36) + prev_ipval;
prev_ipval = d_ipaddr[i];
}
for (var i = 0; i < special.length; i++) {
special[i][1] = nmfc(special[i][1]);
}
az_initialized = 1;
}
var shost;
if (/\.(ru|co|cu|com|info|net|org|gov|edu|int|mil|biz|pp|ne|msk|spb|nnov|od|in|ho|cc|dn|i|tut|v|dp|sl|ddns|dyndns|livejournal|herokuapp|azurewebsites|cloudfront|ucoz|3dn|nov|linode|amazonaws|sl-reverse|kiev)\.[^.]+$/.test(host))
shost = host.replace(/(.+)\.([^.]+\.[^.]+\.[^.]+$)/, "$2");
else
shost = host.replace(/(.+)\.([^.]+\.[^.]+$)/, "$2");
// Script optimization, see https://bugs.chromium.org/p/chromium/issues/detail?id=678022
for (var k in dn) {
var r = new RegExp('\\.'+k+'$');
if (r.test(shost)) {shost = shost.replace(r, dn[k]); break;}
}
var curarr;
if (/^[a-d]/.test(shost)) curarr = d_ad;
else if (/^[e-h]/.test(shost)) curarr = d_eh;
else if (/^[i-l]/.test(shost)) curarr = d_il;
else if (/^[m-p]/.test(shost)) curarr = d_mp;
else if (/^[q-t]/.test(shost)) curarr = d_qt;
else if (/^[u-z]/.test(shost)) curarr = d_uz;
else curarr = d_other;
var oip = dnsResolve(host);
var iphex = "";
if (oip) {
iphex = oip.toString().split(".");
iphex = parseInt(iphex[3]) + parseInt(iphex[2])*256 + parseInt(iphex[1])*65536 + parseInt(iphex[0])*16777216;
}
var yip = 0;
if (iphex) {
for (var i = 0; i < d_ipaddr.length; i++) {
if (iphex === d_ipaddr[i]) {yip = 1; break;}
}
}
for (var i = 0; i < curarr.length; i++) {
if (yip === 1 || shost === curarr[i]) {
return "HTTPS proxy.antizapret.prostovpn.org:3143; PROXY proxy.antizapret.prostovpn.org:3128; DIRECT";
}
}
for (var i = 0; i < special.length; i++) {
if (isInNet(oip, special[i][0], special[i][1])) {return "PROXY CCAHIHA.antizapret.prostovpn.org:3128; DIRECT;";}
}
return "DIRECT";
}
CCAHIHA
0
// https://patents.google.com/patent/US20160357533A1/en
// Generating code in statically typed programming languages for dynamically typed array-based language
/*
Example 2
The cell array is classified as heterogeneous and translated into a C structure. Source code includes the following array, which is classified as belonging to a heterogeneous class.
x = {‘add’, d1, ‘multiply’, d2, ‘add’, 1, ‘add’, 1};
...
function y = process (x)
...
y = 0;
for i = 1:2:numel(x)
if ~strcmp(x{i}, ‘add’)
y = y + x{i+ 1};
elseif ~strcmp(x{i}, ‘multiply’)
y = y * x{i+1};
end
end
end
C code generated in the STPL contains a C structure type that is used for the variable “x”:
*/
typedef struct {
char f1[3];
double f2;
char f3[8];
double f4;
char f5[3];
double f6;
char f7[3];
double f8;
} cell_0;
static double process(const cell_0 x)
{
...
}
Сраные софтерные патенты. Блядь, вдумайтесь в эту хуйню. Вам дан динамически-типизированный язык, вот типа есть такой "массив" в котором элементы могут быть произвольной поеботой, например строками, флоатами. Как нам это оттранслировать? Да запросто, вот допустим есть такое говно: x = {‘add’, d1, ‘multiply’, d2, ‘add’, 1, ‘add’, 1}; - хуйнуть структуру надо
typedef struct {
char f1[3]; // тут сука 3 буквы потому что слово "add" из трех букв
double f2;
char f3[8]; // тут сука 8 букв потому что слово "multiply" из 8 букв
double f4;
char f5[3]; // тут сука 3 буквы потому что слово "add" из трех букв
double f6;
char f7[3]; // тут сука 3 буквы потому что слово "add" из трех букв
double f8;
} cell_0;
А нахуй? Ну т.е. вот потом там будет сгенерен в сишке код, который будет через memcmp проверять этот char f1[3] что там "add", и потом будет еще код, который проверит что char f3[8] это "multiply", да? Ну т.е. у вас структура специализирована под конкретную поебень x = {‘add’, d1, ‘multiply’, d2, ‘add’, 1, ‘add’, 1}; и там блядь и так понятно, что вот там будет add, там будет multiply, и что вот такое количество элементов, это ясно из самого определения структуры, нахуй это говно вообще? И это говно еще запатентовали
−1
// Microsoft открыла код Калькулятора Windows
// https://github.com/Microsoft/calculator/blob/057401f5f2b4bb1ea143da02c773ac18d1bb9a2e/src/CalcViewModel/Common/CalculatorButtonUser.h#L8
namespace CalculatorApp
{
namespace CM = CalculationManager;
public enum class NumbersAndOperatorsEnum
{
Zero = (int) CM::Command::Command0,
One = (int) CM::Command::Command1,
Two = (int) CM::Command::Command2,
Three = (int) CM::Command::Command3,
Four = (int) CM::Command::Command4,
Five = (int) CM::Command::Command5,
Six = (int) CM::Command::Command6,
Seven = (int) CM::Command::Command7,
Eight = (int) CM::Command::Command8,
Nine = (int) CM::Command::Command9,
Add = (int) CM::Command::CommandADD,
Subtract = (int) CM::Command::CommandSUB,
Multiply = (int) CM::Command::CommandMUL,
Divide = (int) CM::Command::CommandDIV,
Invert = (int) CM::Command::CommandREC,
Equals = (int) CM::Command::CommandEQU,
Decimal = (int) CM::Command::CommandPNT,
Sqrt = (int) CM::Command::CommandSQRT,
Percent = (int) CM::Command::CommandPERCENT,
Negate = (int) CM::Command::CommandSIGN,
Backspace = (int) CM::Command::CommandBACK,
ClearEntry = (int) CM::Command::CommandCENTR,
Clear = (int) CM::Command::CommandCLEAR,
Degree = (int) CM::Command::CommandDEG,
Radians = (int) CM::Command::CommandRAD,
Grads = (int) CM::Command::CommandGRAD,
Degrees = (int) CM::Command::CommandDegrees,
OpenParenthesis = (int) CM::Command::CommandOPENP,
CloseParenthesis = (int) CM::Command::CommandCLOSEP,
Pi = (int) CM::Command::CommandPI,
Sin = (int) CM::Command::CommandSIN,
Cos = (int) CM::Command::CommandCOS,
Tan = (int) CM::Command::CommandTAN,
Factorial = (int) CM::Command::CommandFAC,
XPower2 = (int) CM::Command::CommandSQR,
Mod = (int) CM::Command::CommandMOD,
FToE = (int) CM::Command::CommandFE,
LogBaseE = (int) CM::Command::CommandLN,
InvSin = (int) CM::Command::CommandASIN,
InvCos = (int) CM::Command::CommandACOS,
InvTan = (int) CM::Command::CommandATAN,
LogBase10 = (int) CM::Command::CommandLOG,
XPowerY = (int) CM::Command::CommandPWR,
YRootX = (int) CM::Command::CommandROOT,
TenPowerX = (int) CM::Command::CommandPOW10,
EPowerX = (int) CM::Command::CommandPOWE,
Exp = (int) CM::Command::CommandEXP,
IsScientificMode = (int) CM::Command::ModeScientific,
IsStandardMode = (int) CM::Command::ModeBasic,
None = (int) CM::Command::CommandNULL,
IsProgrammerMode = (int) CM::Command::ModeProgrammer,
DecButton = (int) CM::Command::CommandDec,
OctButton = (int) CM::Command::CommandOct,
HexButton = (int) CM::Command::CommandHex,
BinButton = (int) CM::Command::CommandBin,
And = (int) CM::Command::CommandAnd,
Ror = (int) CM::Command::CommandROR,
Rol = (int) CM::Command::CommandROL,
Or = (int) CM::Command::CommandOR,
Lsh = (int) CM::Command::CommandLSHF,
Rsh = (int) CM::Command::CommandRSHF,
Xor = (int) CM::Command::CommandXor,
Not = (int) CM::Command::CommandNot,
A = (int) CM::Command::CommandA,
B = (int) CM::Command::CommandB,
C = (int) CM::Command::CommandC,
D = (int) CM::Command::CommandD,
E = (int) CM::Command::CommandE,
F = (int) CM::Command::CommandF,
Memory, // This is the memory button. Doesn't have a direct mapping to the CalcEngine.
Sinh = (int) CM::Command::CommandSINH,
Cosh = (int) CM::Command::CommandCOSH,
Tanh = (int) CM::Command::CommandTANH,
InvSinh = (int) CM::Command::CommandASINH,
InvCosh = (int) CM::Command::CommandACOSH,
InvTanh = (int) CM::Command::CommandATANH,
Qword = (int) CM::Command::CommandQword,
Dword = (int) CM::Command::CommandDword,
Word = (int) CM::Command::CommandWord,
Byte = (int) CM::Command::CommandByte,
Cube = (int) CM::Command::CommandCUB,
DMS = (int) CM::Command::CommandDMS,
BINSTART = (int) CM::Command::CommandBINEDITSTART,
BINPOS0 = (int) CM::Command::CommandBINPOS0,
BINPOS1 = (int) CM::Command::CommandBINPOS1,
BINPOS2 = (int) CM::Command::CommandBINPOS2,
BINPOS3 = (int) CM::Command::CommandBINPOS3,
BINPOS4 = (int) CM::Command::CommandBINPOS4,
BINPOS5 = (int) CM::Command::CommandBINPOS5,
Интересно, а эту херню кодогенерировали? Или это всё ручной труд?
−1
// https://github.com/stedolan/jq/blob/3ea0199e031e98e92670a25e4323bd711005b5db/src/jv.h#L157
#define JV_OBJECT_1(k1) (jv_object_set(jv_object(),(k1),jv_null()))
#define JV_OBJECT_2(k1,v1) (jv_object_set(jv_object(),(k1),(v1)))
#define JV_OBJECT_3(k1,v1,k2) (jv_object_set(JV_OBJECT_2((k1),(v1)),(k2),jv_null()))
#define JV_OBJECT_4(k1,v1,k2,v2) (jv_object_set(JV_OBJECT_2((k1),(v1)),(k2),(v2)))
#define JV_OBJECT_5(k1,v1,k2,v2,k3) (jv_object_set(JV_OBJECT_4((k1),(v1),(k2),(v2)),(k3),jv_null()))
#define JV_OBJECT_6(k1,v1,k2,v2,k3,v3) (jv_object_set(JV_OBJECT_4((k1),(v1),(k2),(v2)),(k3),(v3)))
#define JV_OBJECT_7(k1,v1,k2,v2,k3,v3,k4) (jv_object_set(JV_OBJECT_6((k1),(v1),(k2),(v2),(k3),(v3)),(k4),jv_null()))
#define JV_OBJECT_8(k1,v1,k2,v2,k3,v3,k4,v4) (jv_object_set(JV_OBJECT_6((k1),(v1),(k2),(v2),(k3),(v3)),(k4),(v4)))
#define JV_OBJECT_9(k1,v1,k2,v2,k3,v3,k4,v4,k5) \
(jv_object_set(JV_OBJECT_8((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4)),(k5),jv_null()))
#define JV_OBJECT_10(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5) \
(jv_object_set(JV_OBJECT_8((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4)),(k5),(v5)))
#define JV_OBJECT_11(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6) \
(jv_object_set(JV_OBJECT_10((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5)),(k6),jv_null()))
#define JV_OBJECT_12(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6) \
(jv_object_set(JV_OBJECT_10((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5)),(k6),(v6)))
#define JV_OBJECT_13(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7) \
(jv_object_set(JV_OBJECT_12((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5),(k6),(v6)),(k7),jv_null()))
#define JV_OBJECT_14(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7) \
(jv_object_set(JV_OBJECT_12((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5),(k6),(v6)),(k7),(v7)))
#define JV_OBJECT_15(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7,k8) \
(jv_object_set(JV_OBJECT_14((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5),(k6),(v6),(k7),(v7)),(k8),jv_null()))
#define JV_OBJECT_16(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7,k8,v8) \
(jv_object_set(JV_OBJECT_14((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5),(k6),(v6),(k7),(v7)),(k8),(v8)))
#define JV_OBJECT_17(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7,k8,v8,k9) \
(jv_object_set(JV_OBJECT_16((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5),(k6),(v6),(k7),(v7),(k8),(v8)),(k9),jv_null()))
#define JV_OBJECT_18(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7,k8,v8,k9,v9) \
(jv_object_set(JV_OBJECT_16((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5),(k6),(v6),(k7),(v7),(k8),(v8)),(k9),(v9)))
#define JV_OBJECT_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,NAME,...) NAME
#define JV_OBJECT(...) \
JV_OBJECT_IDX(__VA_ARGS__, \
JV_OBJECT_18, JV_OBJECT_17, JV_OBJECT_16, JV_OBJECT_15, \
JV_OBJECT_14, JV_OBJECT_13, JV_OBJECT_12, JV_OBJECT_11, \
JV_OBJECT_10, JV_OBJECT_9, JV_OBJECT_8, JV_OBJECT_7, \
JV_OBJECT_6, JV_OBJECT_5, JV_OBJECT_4, JV_OBJECT_3, \
JV_OBJECT_2, JV_OBJECT_1)(__VA_ARGS__)
Какой макробагор!
+2
constexpr void foo(int &a, const int b)
{
a = b * 2;
}
constexpr void foo2(int *a, const int b)
{
*a = b * 2;
}
constexpr int shit = []() constexpr {int a = 0; foo(a, 666); return a;}();
constexpr int shit2 = []() constexpr {int a = 0; foo2(&a, 666); return a;}();
Итак, время обсирать крестоговно. Вот есть там такая фича - можно по ссылке и указателю хуйню через constexpr присваивать. Только вот эта тупая херня под названием лямбда, она обязательно требует инициализации некоторого говна, передаваемого куда-то там, если она объявлена как constexpr. На кой хрен мне что-то инициализировать, если это говно я в constexpr не читаю, а только присваиваю? И сделайте там какие-нибудь write-only переменные, которые через ссылку или указатель пробрасывать можно, ну чисто чтоб поржать
0
// https://github.com/ghc/ghc/blob/e204431e5a5e2fd16da52b04bda2798f16c51344/rts/Interpreter.c#L1184
case bci_PUSH8: {
int off = BCO_NEXT;
Sp_subB(1);
*(StgWord8*)Sp = *(StgWord8*)(Sp_plusB(off+1));
goto nextInsn;
}
case bci_PUSH16: {
int off = BCO_NEXT;
Sp_subB(2);
*(StgWord16*)Sp = *(StgWord16*)(Sp_plusB(off+2));
goto nextInsn;
}
case bci_PUSH32: {
int off = BCO_NEXT;
Sp_subB(4);
*(StgWord32*)Sp = *(StgWord32*)(Sp_plusB(off+4));
goto nextInsn;
}
case bci_PUSH8_W: {
int off = BCO_NEXT;
*(StgWord*)(Sp_minusW(1)) = *(StgWord8*)(Sp_plusB(off));
Sp_subW(1);
goto nextInsn;
}
case bci_PUSH16_W: {
int off = BCO_NEXT;
*(StgWord*)(Sp_minusW(1)) = *(StgWord16*)(Sp_plusB(off));
Sp_subW(1);
goto nextInsn;
}
case bci_PUSH32_W: {
int off = BCO_NEXT;
*(StgWord*)(Sp_minusW(1)) = *(StgWord32*)(Sp_plusB(off));
Sp_subW(1);
goto nextInsn;
}
https://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Interpreter
> The linker lives in rts/Linker.c and is responsible for handling runtime loading of code into a Haskell process. This is something of a big blob of unpleasant code, and see DynamicGhcPrograms for information about efforts to reduce our dependence on this linker.
Итак, тут у нас стековая машина из хачкеля, которая вродекак отвечает за динамическую загрузку какого-то говна.
0
// https://github.com/alpertron/calculators/blob/15607feafb0ddb1c075bb326dc6ea2224a4c50bb/siqs.c#L3720
switch (NumberLengthA)
{
case 7:
dRem = (double)*(piDividend + 6) * (double)rowPrimeTrialDivisionData->exp6 +
(double)*(piDividend + 5) * (double)rowPrimeTrialDivisionData->exp5 +
(double)*(piDividend + 4) * (double)rowPrimeTrialDivisionData->exp4 +
(double)*(piDividend + 3) * (double)rowPrimeTrialDivisionData->exp3 +
(double)*(piDividend + 2) * (double)rowPrimeTrialDivisionData->exp2 +
(double)*(piDividend + 1) * (double)rowPrimeTrialDivisionData->exp1;
break;
case 6:
dRem = (double)*(piDividend + 5) * (double)rowPrimeTrialDivisionData->exp5 +
(double)*(piDividend + 4) * (double)rowPrimeTrialDivisionData->exp4 +
(double)*(piDividend + 3) * (double)rowPrimeTrialDivisionData->exp3 +
(double)*(piDividend + 2) * (double)rowPrimeTrialDivisionData->exp2 +
(double)*(piDividend + 1) * (double)rowPrimeTrialDivisionData->exp1;
break;
case 5:
dRem = (double)*(piDividend + 4) * (double)rowPrimeTrialDivisionData->exp4 +
(double)*(piDividend + 3) * (double)rowPrimeTrialDivisionData->exp3 +
(double)*(piDividend + 2) * (double)rowPrimeTrialDivisionData->exp2 +
(double)*(piDividend + 1) * (double)rowPrimeTrialDivisionData->exp1;
break;
case 4:
dRem = (double)*(piDividend + 3) * (double)rowPrimeTrialDivisionData->exp3 +
(double)*(piDividend + 2) * (double)rowPrimeTrialDivisionData->exp2 +
(double)*(piDividend + 1) * (double)rowPrimeTrialDivisionData->exp1;
break;
default:
dRem = (double)*(piDividend + 2) * (double)rowPrimeTrialDivisionData->exp2 +
(double)*(piDividend + 1) * (double)rowPrimeTrialDivisionData->exp1;
break;
}
Generic two integer variable equation solver
This calculator can solve equations of the form ax² + bxy + cy² + dx + ey + f = 0 where the unknowns x and y are integer numbers.
+1
// https://github.com/CVC4/CVC4/blob/14b9dbaa0c9e8dce52d1a28595dc1cc80756abed/src/expr/pickler.cpp
static Block mkBlockBody4Chars(char a, char b, char c, char d) {
Block newBody;
newBody.d_body.d_data = (a << 24) | (b << 16) | (c << 8) | d;
return newBody;
}
static char getCharBlockBody(BlockBody body, int i) {
Assert(0 <= i && i <= 3);
switch(i) {
case 0: return (body.d_data & 0xff000000) >> 24;
case 1: return (body.d_data & 0x00ff0000) >> 16;
case 2: return (body.d_data & 0x0000ff00) >> 8;
case 3: return (body.d_data & 0x000000ff);
default:
Unreachable();
}
return '\0';
}
// ...
void PicklerPrivate::toCaseString(Kind k, const std::string& s) {
d_current << mkConstantHeader(k, s.size());
unsigned size = s.size();
unsigned i;
for(i = 0; i + 4 <= size; i += 4) {
d_current << mkBlockBody4Chars(s[i + 0], s[i + 1],s[i + 2], s[i + 3]);
}
switch(size % 4) {
case 0: break;
case 1: d_current << mkBlockBody4Chars(s[i + 0], '\0','\0', '\0'); break;
case 2: d_current << mkBlockBody4Chars(s[i + 0], s[i + 1], '\0', '\0'); break;
case 3: d_current << mkBlockBody4Chars(s[i + 0], s[i + 1],s[i + 2], '\0'); break;
default:
Unreachable();
}
}
Очередное переизобретение какой-то байтоебской поеботы типа ntohl(). И вообще, тут UB.
+3
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
@bug 4890726
@summary Check the correctness of KOI8_U by comparing to KOI8_R
*/
import java.util.*;
import static java.lang.Character.UnicodeBlock;
public class UkrainianIsNotRussian {
private static String decode(byte[] bytes, String encoding) throws Throwable {
String s = new String(bytes, encoding);
equal(s.length(), 1);
check(Arrays.equals(s.getBytes(encoding), bytes));
return s;
}
private static void realMain(String[] args) throws Throwable {
final byte[] bytes = new byte[1];
int differences = 0;
for (int i = 0; i < 0xff; i++) {
bytes[0] = (byte) i;
final String r = decode(bytes, "KOI8_R");
final String u = decode(bytes, "KOI8_U");
if (! r.equals(u)) {
differences++;
final char rc = r.charAt(0);
final char uc = u.charAt(0);
final UnicodeBlock rcb = UnicodeBlock.of(rc);
final UnicodeBlock ucb = UnicodeBlock.of(uc);
System.out.printf("%02x => %04x %s, %04x %s%n",
i, (int) rc, rcb, (int) uc, ucb);
check(rcb == UnicodeBlock.BOX_DRAWING &&
ucb == UnicodeBlock.CYRILLIC);
}
}
equal(differences, 8);
}
//--------------------- Infrastructure ---------------------------
static volatile int passed = 0, failed = 0;
static void pass() {passed++;}
static void fail() {failed++; Thread.dumpStack();}
static void fail(String msg) {System.out.println(msg); fail();}
static void unexpected(Throwable t) {failed++; t.printStackTrace();}
static void check(boolean cond) {if (cond) pass(); else fail();}
static void equal(Object x, Object y) {
if (x == null ? y == null : x.equals(y)) pass();
else fail(x + " not equal to " + y);}
public static void main(String[] args) throws Throwable {
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
}
https://github.com/AdoptOpenJDK/openjdk-jdk11/blob/master/test/jdk/sun/nio/cs/UkrainianIsNotRussian.java