Import of the watch repository from Pebble

This commit is contained in:
Matthieu Jeanson 2024-12-12 16:43:03 -08:00 committed by Katharine Berry
commit 3b92768480
10334 changed files with 2564465 additions and 0 deletions

View file

@ -0,0 +1,47 @@
// 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 o = {p1: 1,
p2: {p1: 100, p2: 200, p3: 100},
p3: 4,
p4: 7,
p5: 124686,
p6: {p1: 100, p2: 200, p3: 100},
p7: 1},
sum = 0;
for (var p in o)
{
if (p === "p4")
break;
if (typeof (o[p]) === "object")
{
top:
for (var pp in o[p])
{
if (pp === "p2")
break top;
sum += o[p][pp];
}
}
sum += 20;
}
assert(sum === 160);

View file

@ -0,0 +1,45 @@
// 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 o = {p1: 1,
p2: {p1: 100, p2: 200, p3: 100},
p3: 4,
p4: 7,
p5: 124686,
p6: {p1: 100, p2: 200, p3: 100},
p7: 1},
sum = 0;
for (var p in o)
{
if (p === "p4")
break;
if (typeof (o[p]) === "object")
{
for (var pp in o[p])
{
if (pp === "p2")
break;
sum += o[p][pp];
}
}
else
{
sum += 20;
}
}
assert(sum === 140);

View file

@ -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);

View file

@ -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.
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);
}
main ();

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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 o = {p1: 1, p2: 2, p3: 3, p4: 1, p5: 2}, sum = 0;
for (var p in o)
{
if (p === "p3")
{
break;
}
sum += o[p];
}
assert(sum === 3);

View file

@ -0,0 +1,36 @@
// 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 o = {p1: 1, p2: 2, p3: {p1: 150, p2: 200, p3: 130, p4: 20}, p4: 4, p5: 46}, sum = 0;
for (var p in o)
{
if (p === "p4")
continue;
if (typeof (o[p]) === "object")
{
for (var pp in o[p])
{
if (pp === "p2")
break;
sum += o[p][pp];
}
}
else {
sum += o[p];
}
}
assert(sum === 199);

View file

@ -0,0 +1,25 @@
// 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 o = {a: 1, b: 2, c: 3};
ForLabel:
for (var p in o)
{
if (p === "b")
break ForLabel;
o[p] += 4;
}
assert(o.a + o.b + o.c === 10);

View file

@ -0,0 +1,45 @@
// 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 o = {p1: 1,
p2: {p1: 100, p2: 200, p3: 100},
p3: 4,
p4: 7,
p5: 124686,
p6: {p1: 100, p2: 200, p3: 100},
p7: 1},
sum = 0;
top:
for (var p in o)
{
if (p === "p4")
break;
if (typeof (o[p]) === "object")
{
for (var pp in o[p])
{
if (pp === "p2")
break top;
sum += o[p][pp];
}
}
sum += 20;
}
assert(sum === 120)