This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int recursive_sum_vector (int *X, int start, int end) | |
{ | |
int n = end - start; | |
if (n > 1) | |
{ | |
sum = 0; | |
#pragma omp task | |
sum += recursive_sum_vector(x,start, n /2); | |
#pragma omp task | |
sum += recursive_sum_vector(x,(n+1/2), end); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void sum_vector(int *X, int n) | |
{ | |
int sum = 0; | |
int i; | |
omp_set_num_threads(NTHREADS); | |
#pragma omp parallel for firstprivate (sum) reduction (+:sum) | |
{ | |
for(i = 0; i < n; ++i) | |
sum += X[i] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PomoJS.Models.Task extends Backbone.Model | |
url: -> | |
url = "/tasks" | |
url += "/#{@.getId()}" unless @.isNew() | |
return url | |
defaults: { | |
name: '', | |
completed: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "won't save with negative id", -> | |
@task.set({id: -1}) | |
expect(@task.isValid()).toBeFalsy() | |
it "won't save with negative estimation", -> | |
@task.set({estimation: -2}) | |
expect(@task.isValid()).toBeFalsy() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PomoJS.Models.Task extends Backbone.Model | |
url: -> | |
url = "/tasks" | |
url += "/#{@.getId()}" unless @.isNew() | |
return url | |
defaults: { | |
name: '', | |
completed: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'server requests', -> | |
describe 'on create', -> | |
beforeEach -> | |
new_task = new PomoJS.Models.Task() | |
new_task.save() | |
@request = @server.requests[0] | |
it 'should be POST', -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PomoJS.Models.Task extends Backbone.Model | |
url: "/tasks" | |
defaults: { | |
name: '', | |
completed: false, | |
estimation: 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "save", -> | |
beforeEach -> | |
@server = sinon.fakeServer.create() | |
afterEach -> | |
@server.restore() | |
it 'sends valid data to the server', -> | |
@task.save {name: 'new task name', estimation: 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PomoJS.Models.Task extends Backbone.Model | |
defaults: { | |
name: '', | |
completed: false, | |
estimation: 0 | |
} | |
getId: -> @.get 'id' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'Task', -> | |
#(...) | |
describe "getters", -> | |
describe "getId", -> | |
it "should be defined", -> | |
expect(@task.getId).toBeDefined() |