Add and update tests for exponentiation

This commit is contained in:
Yui T
2015-09-21 16:16:28 -07:00
parent 31b8736408
commit 4fc74b2d8a
4 changed files with 168 additions and 12 deletions

View File

@@ -54,7 +54,7 @@ x5 **= ''
x5 **= {};
var x6: E;
x6 *= b;
x6 *= true;
x6 *= ''
x6 *= {};
x6 **= b;
x6 **= true;
x6 **= ''
x6 **= {};

View File

@@ -0,0 +1,25 @@
// @target:es5
var comp: number;
comp **= 1;
comp **= comp **= 1;
comp **= comp **= 1 + 2;
comp **= comp **= 1 - 2;
comp **= comp **= 1 * 2;
comp **= comp **= 1 / 2;
comp **= comp **= (1 + 2);
comp **= comp **= (1 - 2);
comp **= comp **= (1 * 2);
comp **= comp **= (1 / 2);
comp **= comp **= 1 + 2 ** 3;
comp **= comp **= 1 - 2 ** 4;
comp **= comp **= 1 * 2 ** 5;
comp **= comp **= 1 / 2 ** 6;
comp **= comp **= (1 + 2) ** 3;
comp **= comp **= (1 - 2) ** 4;
comp **= comp **= (1 * 2) ** 5;
comp **= comp **= (1 / 2) ** 6;

View File

@@ -0,0 +1,113 @@
var temp: any;
delete --temp ** 3;
delete ++temp ** 3;
delete temp-- ** 3;
delete temp++ ** 3;
delete -++temp ** 3;
delete -temp++ ** 3;
delete -temp-- ** 3;
delete --temp ** 3 ** 1;
delete ++temp ** 3 ** 1;
delete temp-- ** 3 ** 1;
delete temp++ ** 3 ** 1;
delete -++temp ** 3 ** 1;
delete -temp++ ** 3 ** 1;
delete -temp-- ** 3 ** 1;;
<number>--temp ** 3;
<number>++temp ** 3;
<number>temp-- ** 3;
<number>temp++ ** 3;
<number>-++temp ** 3;
<number>-temp++ ** 3;
<number>-temp-- ** 3;
<number>--temp ** 3 ** 1;
<number>++temp ** 3 ** 1;
<number>temp-- ** 3 ** 1;
<number>temp++ ** 3 ** 1;
<number>-++temp ** 3 ** 1;
<number>-temp++ ** 3 ** 1;
<number>-temp-- ** 3 ** 1;
typeof --temp ** 3;
typeof temp-- ** 3;
typeof 3 ** 4;
typeof temp++ ** 4;
typeof temp-- ** 4;
typeof -3 ** 4;
typeof -++temp ** 4;
typeof -temp++ ** 4;
typeof -temp-- ** 4;
typeof --temp ** 3 ** 1;
typeof temp-- ** 3 ** 1;
typeof 3 ** 4 ** 1;
typeof temp++ ** 4 ** 1;
typeof temp-- ** 4 ** 1;
typeof -3 ** 4 ** 1;
typeof -++temp ** 4 ** 1;
typeof -temp++ ** 4 ** 1;
typeof -temp-- ** 4 ** 1;
void --temp ** 3;
void temp-- ** 3;
void 3 ** 4;
void temp++ ** 4;
void temp-- ** 4;
void -3 ** 4;
void -++temp ** 4;
void -temp++ ** 4;
void -temp-- ** 4;
void --temp ** 3 ** 1;
void temp-- ** 3 ** 1;
void 3 ** 4 ** 1;
void temp++ ** 4 ** 1;
void temp-- ** 4 ** 1;
void -3 ** 4 ** 1;
void -++temp ** 4 ** 1;
void -temp++ ** 4 ** 1;
void -temp-- ** 4 ** 1;
~ --temp ** 3;
~ temp-- ** 3;
~ 3 ** 4;
~ temp++ ** 4;
~ temp-- ** 4;
~ -3 ** 4;
~ -++temp ** 4;
~ -temp++ ** 4;
~ -temp-- ** 4;
~ --temp ** 3 ** 1;
~ temp-- ** 3 ** 1;
~ 3 ** 4 ** 1;
~ temp++ ** 4 ** 1;
~ temp-- ** 4 ** 1;
~ -3 ** 4 ** 1;
~ -++temp ** 4 ** 1;
~ -temp++ ** 4 ** 1;
~ -temp-- ** 4 ** 1;
! --temp ** 3;
! temp-- ** 3;
! 3 ** 4;
! temp++ ** 4;
! temp-- ** 4;
! -3 ** 4;
! -++temp ** 4;
! -temp++ ** 4;
! -temp-- ** 4;
! --temp ** 3 ** 1;
! temp-- ** 3 ** 1;
! 3 ** 4 ** 1;
! temp++ ** 4 ** 1;
! temp-- ** 4 ** 1;
! -3 ** 4 ** 1;
! -++temp ** 4 ** 1;
! -temp++ ** 4 ** 1;
! -temp-- ** 4 ** 1;

View File

@@ -1,10 +1,28 @@
var t1 = 10;
var t2 = 10;
console.log(`${t1 ** t2}`)
console.log(`${t1 ** t2 ** t1}`)
console.log(`${t1 + t2 ** t1}`)
console.log(`${t1 - t2 ** t1}`)
console.log(`${t1 ** t2 + t1}`)
console.log(`${t1 ** t2 - t1}`)
console.log(`${t1 + t2 ** t2 + t1}`)
console.log(`${t1 - t2 ** t2 - t1}`)
var s;
`Exp: ${t1 ** t2} abc`;
`Exp: ${t1 ** t2 ** t1} abc`;
`Exp: ${t1 + t2 ** t1} abc`;
`Exp: ${t1 - t2 ** t1} abc`;
`Exp: ${t1 ** t2 + t1} abc`;
`Exp: ${t1 ** t2 - t1} abc`;
`Exp: ${t1 + t2 ** t2 + t1} abc`;
`Exp: ${t1 - t2 ** t2 - t1} abc`;
`Exp: ${-t1 ** t2 - t1} abc`;
`Exp: ${+t1 ** t2 - t1} abc`;
`Exp: ${-++t1 ** t2 - t1} abc`;
`Exp: ${+--t1 ** t2 - t1} abc`;
`Exp: ${-t1++ ** t2 - t1} abc`;
`Exp: ${-t1-- ** t2 - t1} abc`;
`Exp: ${+t1++ ** t2 - t1} abc`;
`Exp: ${+t1-- ** t2 - t1} abc`;
`Exp: ${typeof t1 ** t2 ** t1} abc`;
`Exp: ${typeof t1 ** t2 + t1} abc`;
`Exp: ${typeof t1 ** (t2 - t1)} abc`;
`Exp: ${1 + typeof t1 ** t2 ** t1} abc`;
`Exp: ${2 + typeof t1 ** t2 ** ++t1} abc`;
`Exp: ${3 + typeof t1 ** t2 ** --t1} abc`;
`Exp: ${!t1 ** t2 ** t1} abc`;
`Exp: ${!t1 ** t2 ** ++t1} abc`;
`Exp: ${!t1 ** t2 ** --t1} abc`;