-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from opendatacam/release-0.9.1
Release 0.9.1
- Loading branch information
Showing
4 changed files
with
65 additions
and
22 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,54 @@ | ||
const ItemTracked = require('../ItemTracked'); | ||
|
||
describe("ItemTracked", function () { | ||
const properties = { | ||
x: null, | ||
y: null, | ||
w: null, | ||
h: null, | ||
name: "dummy", | ||
confidence: null | ||
}; | ||
|
||
describe("idDisplay", function () { | ||
const properties = { | ||
x: null, | ||
y: null, | ||
w: null, | ||
h: null, | ||
name: "dummy", | ||
confidence: null | ||
}; | ||
const item1 = ItemTracked.ItemTracked(properties); | ||
const item2 = ItemTracked.ItemTracked(properties); | ||
|
||
it('starts at 0', function() { | ||
expect(item1.idDisplay).toBe(0); | ||
it('starts at 0', function () { | ||
expect(item1.idDisplay).toBe(0); | ||
}); | ||
|
||
it('icrements IDs', function() { | ||
it('icrements IDs', function () { | ||
expect(item1.idDisplay).toBeLessThan(item2.idDisplay); | ||
}); | ||
|
||
it('resets IDs', function() { | ||
ItemTracked.reset(); | ||
const item3 = ItemTracked.ItemTracked(properties); | ||
expect(item3.idDisplay).toBe(0); | ||
it('resets IDs', function () { | ||
ItemTracked.reset(); | ||
const item3 = ItemTracked.ItemTracked(properties); | ||
expect(item3.idDisplay).toBe(0); | ||
}); | ||
}); | ||
|
||
describe('itemHistory', () => { | ||
it('stops at max length', () => { | ||
const item1 = ItemTracked.ItemTracked(properties); | ||
for (var i = 0; i < ItemTracked.ITEM_HISTORY_MAX_LENGTH + 2; i++) { | ||
item1.update(properties, i); | ||
expect(item1.itemHistory.length).toBeLessThanOrEqual(ItemTracked.ITEM_HISTORY_MAX_LENGTH); | ||
} | ||
}); | ||
|
||
it('does not store history', () => { | ||
const originalItemHistoryMaxLen = ItemTracked.ITEM_HISTORY_MAX_LENGTH; | ||
ItemTracked.ITEM_HISTORY_MAX_LENGTH = 0; | ||
const item1 = ItemTracked.ItemTracked(properties); | ||
|
||
for (var i = 0; i < ItemTracked.ITEM_HISTORY_MAX_LENGTH + 2; i++) { | ||
item1.update(properties, i); | ||
expect(item1.itemHistory.length).toBe(ItemTracked.ITEM_HISTORY_MAX_LENGTH); | ||
} | ||
|
||
ItemTracked.ITEM_HISTORY_MAX_LENGTH = originalItemHistoryMaxLen; | ||
}); | ||
}); | ||
}); |