-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace torch.Tester with totem.Tester + extra stuff.
This should bring a lot of benefit to code that uses torch.Tester (totem will eventually become deprecated). Note that torch.Tester and totem.Tester once shared the same code - this change brings it full circle. At a glance, extra functionality includes: - A general equality checker that accepts many different objects. - Deep table comparison with precision checking. - Stricter argument checking in using the test functions. - Better output. - torch.Storage comparison. - Extra features for fine-grained control of testing.
- Loading branch information
1 parent
3bbb49f
commit d8ff64c
Showing
12 changed files
with
1,775 additions
and
292 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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
function torch.TestSuite() | ||
local obj = { | ||
__tests = {}, | ||
__isTestSuite = true | ||
} | ||
|
||
local metatable = {} | ||
|
||
function metatable:__index(key) | ||
return self.__tests[key] | ||
end | ||
|
||
function metatable:__newindex(key, value) | ||
if self.__tests[key] ~= nil then | ||
error("Test " .. tostring(key) .. " is already defined.") | ||
end | ||
if type(value) ~= "function" then | ||
if type(value) == "table" then | ||
error("Nested tables of tests are not supported") | ||
else | ||
error("Only functions are supported as members of a TestSuite") | ||
end | ||
end | ||
self.__tests[key] = value | ||
end | ||
|
||
setmetatable(obj, metatable) | ||
|
||
return obj | ||
end |
Oops, something went wrong.
d8ff64c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indroduced circular dependency sys <->torch7.
d8ff64c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really, sys only (wrongly) depends on torch7 in it's rockspec, but doesn't actually depend on it in the code itself.
d8ff64c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that too :).
Sys should be fixed as now it leads to the thing below.
I can prepare PR for sys - let me know!
-- Installing: /home/bfomitchev/git/distro/install/lib/luarocks/rocks/paths/scm-1/lib/libpaths.so
Updating manifest for /home/bfomitchev/git/distro/install/lib/luarocks/rocks
paths scm-1 is now built and installed in /home/bfomitchev/git/distro/install/ (license: BSD)
Missing dependencies for torch:
sys >= 1.0
Using https://raw.githubusercontent.com/torch/rocks/master/sys-1.1-0.rockspec... switching to 'build' mode
Missing dependencies for sys:
torch >= 7.0
Using https://raw.githubusercontent.com/torch/rocks/master/torch-scm-1.rockspec... switching to 'build' mode
Cloning into 'torch7'...
d8ff64c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also - sys does use Torch cmake macros, so the build-time dependency is real - sys build would fail if torch7 not installed first - luarocks defect? But yes, can be easily fixed by sys not using torch7 macros.