23 lines
595 B
Plaintext
23 lines
595 B
Plaintext
// Test text module
|
|
var text = use('text')
|
|
var blob = use('blob')
|
|
|
|
// Create a test blob with some data
|
|
var b = new blob()
|
|
b.write_text("Hello")
|
|
b.stone()
|
|
|
|
log.console("Original blob content (as text):", text(b))
|
|
log.console("Hex encoding:", text(b, 'h'))
|
|
log.console("Base32 encoding:", text(b, 't'))
|
|
|
|
// Test with binary data
|
|
var b2 = new blob()
|
|
b2.write_fit(255, 8)
|
|
b2.write_fit(170, 8) // 10101010 in binary
|
|
b2.write_fit(15, 8) // 00001111 in binary
|
|
b2.stone()
|
|
|
|
log.console("\nBinary data tests:")
|
|
log.console("Hex encoding:", text(b2, 'h'))
|
|
log.console("Base32 encoding:", text(b2, 't')) |