Copying and reducing test suite for Compact profile.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var sum = 0;
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
if (i === 5)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sum += i;
|
||||
}
|
||||
|
||||
assert(sum === 10);
|
||||
@@ -0,0 +1,28 @@
|
||||
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
function main()
|
||||
{
|
||||
var sum = 0;
|
||||
for (var i = 0; i < 10; i++)
|
||||
for (var j = 0; j < 20; j++)
|
||||
{
|
||||
if (j === 10)
|
||||
break;
|
||||
|
||||
sum += 1;
|
||||
}
|
||||
}
|
||||
|
||||
assert(sum === 100);
|
||||
@@ -0,0 +1,28 @@
|
||||
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var sum = 0;
|
||||
|
||||
ForLabel:
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
if (i === 5)
|
||||
{
|
||||
break ForLabel;
|
||||
}
|
||||
|
||||
sum += i;
|
||||
}
|
||||
|
||||
assert(sum === 10);
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var sum = 0;
|
||||
top:
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
for (var j = 0; j < 20; j++)
|
||||
{
|
||||
if (j > 9 && i % 2)
|
||||
break top;
|
||||
|
||||
sum += 1;
|
||||
}
|
||||
|
||||
sum += 1;
|
||||
}
|
||||
|
||||
assert(sum === 31);
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var mask = 0xff0f;
|
||||
var numOnes = 0;
|
||||
|
||||
while (mask)
|
||||
{
|
||||
if (!(mask & 1))
|
||||
break;
|
||||
|
||||
mask >>= 1;
|
||||
numOnes++;
|
||||
}
|
||||
|
||||
assert(numOnes === 4);
|
||||
@@ -0,0 +1,33 @@
|
||||
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var i = 9;
|
||||
var cnt = 0;
|
||||
|
||||
while (i-- > 0)
|
||||
{
|
||||
if (i % 2)
|
||||
break;
|
||||
|
||||
var j = 0;
|
||||
while (j++ < 20)
|
||||
{
|
||||
if (j % 2 === 0)
|
||||
break;
|
||||
cnt++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
assert(cnt === 1);
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
var sum = 0, i = 0;
|
||||
|
||||
WhileLabel:
|
||||
while (++i < 10)
|
||||
{
|
||||
if (i === 5)
|
||||
{
|
||||
break WhileLabel;
|
||||
}
|
||||
|
||||
sum += i;
|
||||
}
|
||||
|
||||
assert(sum === 10);
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var sum = 0;
|
||||
var i = 0, j = 0;
|
||||
top:
|
||||
while (i++ < 10)
|
||||
{
|
||||
j = 0;
|
||||
while (j++ < 20)
|
||||
{
|
||||
if (j > 9 && i % 2)
|
||||
break top;
|
||||
|
||||
sum += 1;
|
||||
}
|
||||
|
||||
sum += 1;
|
||||
}
|
||||
|
||||
assert(sum === 9);
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var mask = 0xff0f;
|
||||
var numOnes = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (!(mask & 1))
|
||||
break;
|
||||
|
||||
mask >>= 1;
|
||||
numOnes++;
|
||||
} while (mask);
|
||||
|
||||
assert(numOnes === 4);
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var i = 10;
|
||||
var cnt = 0;
|
||||
|
||||
do
|
||||
{
|
||||
var j = 0;
|
||||
do
|
||||
{
|
||||
if (j % 2 === 0)
|
||||
break;
|
||||
cnt++;
|
||||
}
|
||||
while (j++ < 20)
|
||||
|
||||
if (i % 2)
|
||||
break;
|
||||
}
|
||||
while (i-- > 0);
|
||||
|
||||
assert(cnt === 0);
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var sum = 0, i = 0;
|
||||
|
||||
DoWhileLabel:
|
||||
do
|
||||
{
|
||||
if (i === 5)
|
||||
{
|
||||
break DoWhileLabel;
|
||||
}
|
||||
|
||||
sum += i;
|
||||
}
|
||||
while (++i < 10);
|
||||
|
||||
assert(sum === 10);
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var sum = 0;
|
||||
var i = 0, j = 0;
|
||||
top:
|
||||
do
|
||||
{
|
||||
j = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (j > 9 && i % 2)
|
||||
break top;
|
||||
|
||||
sum += 1;
|
||||
}
|
||||
while (j++ < 20);
|
||||
|
||||
sum += 1;
|
||||
}
|
||||
while (i++ < 10);
|
||||
|
||||
assert(sum === 32);
|
||||
Reference in New Issue
Block a user