Skip to content

Commit d18761f

Browse files
salonijuneja21sparkprime
authored andcommitted
Add xnor of 2 booleans
1 parent 3967537 commit d18761f

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

doc/_stdlib_gen/stdlib-content.jsonnet

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,13 @@ local html = import 'html.libsonnet';
14451445
Returns the xor of the two given booleans.
14461446
|||,
14471447
},
1448+
{
1449+
name: 'xnor',
1450+
params: ['x', 'y'],
1451+
description: |||
1452+
Returns the xnor of the two given booleans.
1453+
|||,
1454+
},
14481455
],
14491456
},
14501457
{

stdlib/std.jsonnet

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,4 +1684,6 @@ limitations under the License.
16841684
sum(arr):: std.foldl(function(a,b)a+b,arr,0),
16851685

16861686
xor(x, y):: x!=y,
1687+
1688+
xnor(x, y):: x==y,
16871689
}

test_suite/stdlib.jsonnet

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,4 +1535,7 @@ std.assertEqual(std.sum([1, 2, 3]), 6) &&
15351535
std.assertEqual(std.xor(true, false), true) &&
15361536
std.assertEqual(std.xor(true, true), false) &&
15371537

1538+
std.assertEqual(std.xnor(true, false), false) &&
1539+
std.assertEqual(std.xnor(true, true), true) &&
1540+
15381541
true

0 commit comments

Comments
 (0)